added samples
[windows-sources.git] / sdk / samples / WPFSamples / InvalidateRequeryWithDispatcherTimer / csharp / window1.xaml
blobe78f43f000dbdf0eea72d7c70d1676ded86cc3bf
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"
6     >
8   <!-- Styles for -->
9   <Window.Resources>
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" />
15     </Style>
17     <!--Converter to convert the Slider value property to an int-->
18     <custom:SliderValueConverter x:Key="ValueConverterResource"/>
19   </Window.Resources>
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-->
29   <StackPanel>
31     <!-- Target and Current Seconds Displays-->
32     <StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
33       <Border HorizontalAlignment="Right" 
34               BorderBrush="DarkBlue"
35               BorderThickness="1"
36               Margin="10"
37               Width="75">
38         <StackPanel HorizontalAlignment="Center">
39           <Label>Target</Label>
40           <Label Content="{Binding ElementName=secondSlider,
41                             Path=Value,
42                             Converter={StaticResource ValueConverterResource}}"
43                  Margin="10,0,10,10" 
44                  FontSize="14" 
45                  FontWeight="DemiBold"/>
46         </StackPanel>
47       </Border>
48       <Border HorizontalAlignment="Right" 
49         BorderBrush="DarkBlue"
50         BorderThickness="1"
51         Margin="10"
52         Width="75">
53         <StackPanel HorizontalAlignment="Center">
54           <Label>Seconds</Label>
55           <Label Name="lblSeconds" Margin="10,0,10,10"
56                  FontSize="14" FontWeight="DemiBold"/>
57         </StackPanel>
58       </Border>
59     </StackPanel>
61     <!-- The Command Source for the custom command-->
62     <!-- Passes Slider.Value as the CommandParameter-->
63     <Button Command="{x:Static custom:Window1.customCommand}" 
64             Content="Command"
65             CommandParameter="{Binding ElementName=secondSlider,
66                                 Path=Value,
67                                 Converter={StaticResource ValueConverterResource}}" 
68             Margin="10"/>
69     <!-- Slider used to change the target value-->
70     <Label Margin="10" FontSize="14" HorizontalAlignment="Center">
71       Enable Command When Current Seconds Are Greater Than:
72     </Label>
73     <Border BorderBrush="DarkBlue"
74             BorderThickness="1"
75             Height="75"
76             Width="425">
77       <StackPanel Orientation="Horizontal">
78         <Button Command="Slider.DecreaseSmall"
79                 CommandTarget="{Binding ElementName=secondSlider}"
80                 Height="25"
81                 Width="25"
82                 Content="-"/>
83         <Label VerticalAlignment="Center">0</Label>
84         <Slider Name="secondSlider"
85                 Minimum="0"
86                 Maximum="60"
87                 Value="15"
88                 TickFrequency="5"
89                 Height="50"
90                 Width="275" 
91                 TickPlacement="BottomRight"
92                 LargeChange="5"
93                 SmallChange="5" 
94                 AutoToolTipPlacement="BottomRight" 
95                 AutoToolTipPrecision="0"
96                 MouseWheel="OnSliderMouseWheel"
97                 MouseUp="OnSliderMouseUp">
98         </Slider>
99         <Label VerticalAlignment="Center">60</Label>
100         <Button Command="Slider.IncreaseSmall"
101                 CommandTarget="{Binding ElementName=secondSlider}"
102                 Height="25"
103                 Width="25"
104                 Content="+"/>
105       </StackPanel>
106     </Border>
107     <!-- The custom command results -->
108     <Border BorderBrush="Black"
109             BorderThickness="2"
110             Height="80"
111             Width="300"
112             Margin="0,10,0,0">
113       <StackPanel>
114         <Label HorizontalAlignment="Center" FontWeight="DemiBold">
115           Command Results
116          </Label>
117         <TextBlock Name="txtResults" 
118                    Margin="5,0,5,0" 
119                    TextWrapping="Wrap"
120                    HorizontalAlignment="Left" />
121       </StackPanel>
122     </Border>
123     <!--End main Panel -->
124   </StackPanel>
125   <!--End main Panel -->
126 </Window>