1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
| <Window x:Class="WpfTimerMVVM.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfTimerMVVM"
Title="Window1" Height="300" Width="300">
<Window.DataContext>
<local:DataTimer/>
</Window.DataContext>
<Window.Resources>
<Image x:Key="MyImage1" Source="Images/Bitmap1.bmp"/>
<Image x:Key="MyImage2" Source="Images/Bitmap2.bmp"/>
<!--BooleanToVisibilityConverter converter API .Net
true => Visibility.Visible ,false=> Visibility.Collapsed
-->
<BooleanToVisibilityConverter x:Key="VisibleIfTrueConverter" />
</Window.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0">
<Label Content="Marche" HorizontalAlignment="Center"/>
<Grid >
<Image
Grid.Row="0" Name="imgMarche2" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Height="100" Width="100"
Source="Images/Bitmap2.bmp"
>
<Image.Clip>
<EllipseGeometry Center="50,50" RadiusX="50" RadiusY="50"/>
</Image.Clip>
</Image>
<Image
Grid.Row="0" Name="imgMarche1" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Height="100" Width="100"
Source="Images/Bitmap1.bmp"
Visibility="{Binding VisImgMarche,Converter={StaticResource VisibleIfTrueConverter}}"
>
<Image.Clip>
<EllipseGeometry Center="50,50" RadiusX="50" RadiusY="50"/>
</Image.Clip>
</Image>
</Grid>
<CheckBox Grid.Row="1" Name="checkBoxMarche" Content="On/Off"
HorizontalAlignment="Center"
IsChecked="{Binding MarcheChecked}" />
</StackPanel>
<StackPanel Grid.Column="1">
<Label Content="Alarm" HorizontalAlignment="Center"/>
<Grid >
<Image
Grid.Row="0" Name="imgAlarme2" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Height="100" Width="100"
Source="Images/Bitmap2.bmp"
>
<Image.Clip>
<EllipseGeometry Center="50,50" RadiusX="50" RadiusY="50"/>
</Image.Clip>
</Image>
<Image
Grid.Row="0" Name="imgAlarme1" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Height="100" Width="100"
Source="Images/Bitmap1.bmp"
Visibility="{Binding VisImgAlarme,Converter={StaticResource VisibleIfTrueConverter}}"
>
<Image.Clip>
<EllipseGeometry Center="50,50" RadiusX="50" RadiusY="50"/>
</Image.Clip>
</Image>
</Grid>
<CheckBox Grid.Row="1" Name="checkBoxAlarme" Content="On/Off"
HorizontalAlignment="Center"
IsChecked="{Binding AlarmeChecked}"/>
<Grid>
<!-- valeur de slider exprimées en milliseconds-->
<!-- 1000 millisecondes => 1 seconde-->
<Slider
x:Name="Sld"
AutoToolTipPlacement="BottomRight"
Maximum="4000"
Minimum="300"
Background="SkyBlue"
Foreground="Yellow"
Value="{Binding Path=Duration,Mode=TwoWay}">
</Slider>
</Grid>
</StackPanel>
</Grid>
</Window> |
Partager