You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.4 KiB

2 years ago
<Window x:Class="ProgressBarMVVMSample.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ProgressBarMVVMSample"
xmlns:vm="clr-namespace:ProgressBarMVVMSample.ViewModel"
mc:Ignorable="d"
Title="MainWindow" Height="300" Width="400">
<Window.Resources>
<BooleanToVisibilityConverter x:Key="cvtB2V"/>
</Window.Resources>
<Window.DataContext>
<vm:MainViewModel/>
</Window.DataContext>
<Grid>
<StackPanel Orientation="Vertical">
<Button Width="70" Margin="30"
Content="Start"
Command="{Binding StartWorkCommand}"/>
<Grid x:Name="grdMain" Margin="20"
Visibility="{Binding ProgressVisibility, Converter={StaticResource cvtB2V}}">
<ProgressBar Width="150" Height="20" Margin="20"
Value="{Binding CurrentProgress, Mode=OneWay}"/>
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center"
Text="{Binding CurrentProgress, StringFormat={}{0:0}%}"/>
</Grid>
</StackPanel>
</Grid>
</Window>