added samples
[windows-sources.git] / sdk / samples / WPFSamples / InvalidateRequeryWithSystemTimer / csharp / window1.xaml
blob2e3501cd744acdb088a46ec8760268c3d866ab9c
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="SliderValueConverterReference"/>
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>
27   
28   <!--Start main panel-->
29   <StackPanel>
30     
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 SliderValueConverterReference}}"
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" FontSize="14" FontWeight="DemiBold"/>
56         </StackPanel>
57       </Border>
58     </StackPanel>
59     
60     <!-- The Command Source for the custom command-->
61     <!-- Passes Slider.Value as the CommandParameter-->
62     <Button Command="{x:Static custom:Window1.customCommand}" 
63             Content="Command"
64             CommandParameter="{Binding ElementName=secondSlider,
65                                 Path=Value,
66                                 Converter={StaticResource SliderValueConverterReference}}" 
67             Margin="10"/>
68     
69     <!-- Slider used to change the target value-->
70     <Label Margin="10" FontSize="14">
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>
108     <!-- The custom command results -->
109     <Border BorderBrush="Black"
110             BorderThickness="2"
111             Height="80"
112             Width="300"
113             Margin="0,10,0,0">
114       <StackPanel>
115         <Label HorizontalAlignment="Center" FontWeight="DemiBold">
116           Command Results
117          </Label>
118         <TextBlock Name="txtResults" 
119                    Margin="5,0,5,0" 
120                    TextWrapping="Wrap"
121                    HorizontalAlignment="Left" />
122       </StackPanel>
123     </Border>
125     <!--End main Panel -->
126   </StackPanel>
127   <!--End main Panel -->
128 </Window>