1 <Window x:Class="SDKSamples.Window1"
2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4 xmlns:custom="clr-namespace:SDKSamples"
5 Title="InvalidateRequerySuggested Via DispatcherTimer" Height="400" Width="450"
10 <Style TargetType="{x:Type Button}">
11 <Setter Property="Height" Value="50" />
12 <Setter Property="Width" Value="75" />
13 <Setter Property="Background" Value="AliceBlue"/>
14 <Setter Property="Margin" Value="10" />
17 <!--Converter to convert the Slider value property to an int-->
18 <custom:SliderValueConverter x:Key="SliderValueConverterReference"/>
21 <!-- Command Binding for the Custom Command -->
22 <Window.CommandBindings>
23 <CommandBinding Command="{x:Static custom:Window1.customCommand}"
24 Executed="CustomCommandExecuted"
25 CanExecute="CustomCommandCanExecute" />
26 </Window.CommandBindings>
28 <!--Start main panel-->
31 <!-- Target and Current Seconds Displays-->
32 <StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
33 <Border HorizontalAlignment="Right"
34 BorderBrush="DarkBlue"
38 <StackPanel HorizontalAlignment="Center">
40 <Label Content="{Binding ElementName=secondSlider,
42 Converter={StaticResource SliderValueConverterReference}}"
45 FontWeight="DemiBold"/>
48 <Border HorizontalAlignment="Right"
49 BorderBrush="DarkBlue"
53 <StackPanel HorizontalAlignment="Center">
54 <Label>Seconds</Label>
55 <Label Name="lblSeconds" Margin="10,0,10,10" FontSize="14" FontWeight="DemiBold"/>
60 <!-- The Command Source for the custom command-->
61 <!-- Passes Slider.Value as the CommandParameter-->
62 <Button Command="{x:Static custom:Window1.customCommand}"
64 CommandParameter="{Binding ElementName=secondSlider,
66 Converter={StaticResource SliderValueConverterReference}}"
69 <!-- Slider used to change the target value-->
70 <Label Margin="10" FontSize="14">
71 Enable Command When Current Seconds Are Greater Than:
73 <Border BorderBrush="DarkBlue"
77 <StackPanel Orientation="Horizontal">
78 <Button Command="Slider.DecreaseSmall"
79 CommandTarget="{Binding ElementName=secondSlider}"
83 <Label VerticalAlignment="Center">0</Label>
84 <Slider Name="secondSlider"
91 TickPlacement="BottomRight"
94 AutoToolTipPlacement="BottomRight"
95 AutoToolTipPrecision="0"
96 MouseWheel="OnSliderMouseWheel"
97 MouseUp="OnSliderMouseUp">
99 <Label VerticalAlignment="Center">60</Label>
100 <Button Command="Slider.IncreaseSmall"
101 CommandTarget="{Binding ElementName=secondSlider}"
108 <!-- The custom command results -->
109 <Border BorderBrush="Black"
115 <Label HorizontalAlignment="Center" FontWeight="DemiBold">
118 <TextBlock Name="txtResults"
121 HorizontalAlignment="Left" />
125 <!--End main Panel -->
127 <!--End main Panel -->