|
1 |
| -<UserControl |
2 |
| - x:Class="MetroDemo.ExampleViews.DateExamples" |
3 |
| - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
4 |
| - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
5 |
| - xmlns:Controls="http://metro.mahapps.com/winfx/xaml/controls" |
6 |
| - xmlns:Converters="http://metro.mahapps.com/winfx/xaml/shared" |
7 |
| - xmlns:MetroDemo="clr-namespace:MetroDemo" |
8 |
| - xmlns:behaviors="clr-namespace:MetroDemo.Behaviors" |
9 |
| - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
10 |
| - xmlns:globalization="clr-namespace:System.Globalization;assembly=mscorlib" |
11 |
| - xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" |
12 |
| - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
13 |
| - xmlns:system="clr-namespace:System;assembly=mscorlib" |
14 |
| - d:DataContext="{d:DesignInstance MetroDemo:MainWindowViewModel}" |
15 |
| - d:DesignHeight="600" |
16 |
| - d:DesignWidth="800" |
17 |
| - mc:Ignorable="d"> |
| 1 | +<UserControl x:Class="MetroDemo.ExampleViews.DateExamples" |
| 2 | + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 3 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 4 | + xmlns:Controls="http://metro.mahapps.com/winfx/xaml/controls" |
| 5 | + xmlns:Converters="http://metro.mahapps.com/winfx/xaml/shared" |
| 6 | + xmlns:MetroDemo="clr-namespace:MetroDemo" |
| 7 | + xmlns:behaviors="clr-namespace:MetroDemo.Behaviors" |
| 8 | + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
| 9 | + xmlns:globalization="clr-namespace:System.Globalization;assembly=mscorlib" |
| 10 | + xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" |
| 11 | + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
| 12 | + xmlns:system="clr-namespace:System;assembly=mscorlib" |
| 13 | + d:DataContext="{d:DesignInstance MetroDemo:MainWindowViewModel}" |
| 14 | + d:DesignHeight="600" |
| 15 | + d:DesignWidth="800" |
| 16 | + mc:Ignorable="d"> |
18 | 17 |
|
19 | 18 | <AdornerDecorator>
|
20 | 19 | <Grid>
|
|
27 | 26 | <StackPanel VerticalAlignment="Top">
|
28 | 27 | <Label Content="Date picker" Style="{DynamicResource DescriptionHeaderStyle}" />
|
29 | 28 |
|
30 |
| - <DatePicker |
31 |
| - Width="200" |
32 |
| - Margin="0,10,0,0" |
33 |
| - HorizontalAlignment="Center" |
34 |
| - Controls:TextBoxHelper.UseFloatingWatermark="True" |
35 |
| - Controls:TextBoxHelper.Watermark="Select a date" /> |
36 |
| - <DatePicker |
37 |
| - Width="200" |
38 |
| - Margin="0,10,0,0" |
39 |
| - HorizontalAlignment="Center" |
40 |
| - IsEnabled="False" /> |
41 |
| - <DatePicker |
42 |
| - Width="200" |
43 |
| - Margin="0,10,0,0" |
44 |
| - HorizontalAlignment="Center" |
45 |
| - Controls:TextBoxHelper.AutoWatermark="True" |
46 |
| - Controls:TextBoxHelper.UseFloatingWatermark="True" |
47 |
| - SelectedDate="{Binding Path=DatePickerDate}" /> |
48 |
| - <DatePicker |
49 |
| - Width="300" |
50 |
| - Margin="0,10,0,0" |
51 |
| - HorizontalAlignment="Center" |
52 |
| - Controls:TextBoxHelper.Watermark="Select a date" |
53 |
| - FontSize="22" |
54 |
| - SelectedDate="{Binding DatePickerDate, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True}"> |
| 29 | + <DatePicker Width="200" |
| 30 | + Margin="0,10,0,0" |
| 31 | + HorizontalAlignment="Center" |
| 32 | + Controls:TextBoxHelper.UseFloatingWatermark="True" |
| 33 | + Controls:TextBoxHelper.Watermark="Select a date" /> |
| 34 | + <DatePicker Width="200" |
| 35 | + Margin="0,10,0,0" |
| 36 | + HorizontalAlignment="Center" |
| 37 | + IsEnabled="False" /> |
| 38 | + <DatePicker Width="200" |
| 39 | + Margin="0,10,0,0" |
| 40 | + HorizontalAlignment="Center" |
| 41 | + Controls:TextBoxHelper.AutoWatermark="True" |
| 42 | + Controls:TextBoxHelper.UseFloatingWatermark="True" |
| 43 | + SelectedDate="{Binding Path=DatePickerDate}" /> |
| 44 | + <DatePicker Width="300" |
| 45 | + Margin="0,10,0,0" |
| 46 | + HorizontalAlignment="Center" |
| 47 | + Controls:TextBoxHelper.Watermark="Select a date" |
| 48 | + FontSize="22" |
| 49 | + SelectedDate="{Binding DatePickerDate, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True}"> |
55 | 50 | <Controls:TextBoxHelper.ButtonWidth>
|
56 |
| - <Binding |
57 |
| - Converter="{x:Static Converters:FontSizeOffsetConverter.Instance}" |
58 |
| - Path="FontSize" |
59 |
| - RelativeSource="{RelativeSource Self}"> |
| 51 | + <Binding Converter="{x:Static Converters:FontSizeOffsetConverter.Instance}" |
| 52 | + Path="FontSize" |
| 53 | + RelativeSource="{RelativeSource Self}"> |
60 | 54 | <Binding.ConverterParameter>
|
61 | 55 | <system:Double>5</system:Double>
|
62 | 56 | </Binding.ConverterParameter>
|
|
65 | 59 | </DatePicker>
|
66 | 60 | </StackPanel>
|
67 | 61 |
|
68 |
| - <StackPanel |
69 |
| - Grid.Row="0" |
70 |
| - Grid.Column="1" |
71 |
| - VerticalAlignment="Top"> |
| 62 | + <StackPanel Grid.Row="0" |
| 63 | + Grid.Column="1" |
| 64 | + VerticalAlignment="Top"> |
72 | 65 | <Label Content="Calendar" Style="{DynamicResource DescriptionHeaderStyle}" />
|
73 | 66 |
|
74 | 67 | <Calendar Margin="5" />
|
75 | 68 | <Calendar Margin="5" IsEnabled="False" />
|
76 | 69 | </StackPanel>
|
77 | 70 |
|
78 |
| - <StackPanel |
79 |
| - Grid.Row="0" |
80 |
| - Grid.Column="2" |
81 |
| - Margin="0,0,20,0" |
82 |
| - VerticalAlignment="Top" |
83 |
| - Orientation="Vertical"> |
| 71 | + <StackPanel Grid.Row="0" |
| 72 | + Grid.Column="2" |
| 73 | + Margin="0,0,20,0" |
| 74 | + VerticalAlignment="Top" |
| 75 | + Orientation="Vertical"> |
84 | 76 | <Label Content="DateTime/Time picker" Style="{DynamicResource DescriptionHeaderStyle}" />
|
85 | 77 |
|
86 | 78 | <GroupBox Header="Current time">
|
|
93 | 85 |
|
94 | 86 | <GroupBox Header="Try it yourself">
|
95 | 87 | <StackPanel>
|
96 |
| - <CheckBox |
97 |
| - Name="DateTimePickerIsEnabled" |
98 |
| - Content="IsEnabled" |
99 |
| - IsChecked="True" /> |
| 88 | + <CheckBox Name="DateTimePickerIsEnabled" |
| 89 | + Content="IsEnabled" |
| 90 | + IsChecked="True" /> |
100 | 91 | <CheckBox Name="DateTimePickerIsReadOnly" Content="IsReadOnly" />
|
101 |
| - <CheckBox |
102 |
| - Name="DateTimePickerIsClockVisible" |
103 |
| - Content="IsClockVisible" |
104 |
| - IsChecked="True" /> |
| 92 | + <CheckBox Name="DateTimePickerIsClockVisible" |
| 93 | + Content="IsClockVisible" |
| 94 | + IsChecked="True" /> |
105 | 95 | <Grid>
|
106 | 96 | <Grid.RowDefinitions>
|
107 | 97 | <RowDefinition />
|
|
113 | 103 | <ColumnDefinition />
|
114 | 104 | <ColumnDefinition />
|
115 | 105 | </Grid.ColumnDefinitions>
|
116 |
| - <Label |
117 |
| - Grid.Row="0" |
118 |
| - Grid.Column="0" |
119 |
| - Content="Orientation" /> |
120 |
| - <ComboBox |
121 |
| - Name="DateTimePickerOrientation" |
122 |
| - Grid.Row="0" |
123 |
| - Grid.Column="1" |
124 |
| - SelectedItem="{x:Static Orientation.Horizontal}"> |
| 106 | + <Label Grid.Row="0" |
| 107 | + Grid.Column="0" |
| 108 | + Content="Orientation" /> |
| 109 | + <ComboBox Name="DateTimePickerOrientation" |
| 110 | + Grid.Row="0" |
| 111 | + Grid.Column="1" |
| 112 | + SelectedItem="{x:Static Orientation.Horizontal}"> |
125 | 113 | <ComboBox.ItemsSource>
|
126 | 114 | <x:Array Type="Orientation">
|
127 | 115 | <Orientation>Vertical</Orientation>
|
128 | 116 | <Orientation>Horizontal</Orientation>
|
129 | 117 | </x:Array>
|
130 | 118 | </ComboBox.ItemsSource>
|
131 | 119 | </ComboBox>
|
132 |
| - <Label |
133 |
| - Grid.Row="1" |
134 |
| - Grid.Column="0" |
135 |
| - Content="PickerVisibility" /> |
136 |
| - <ComboBox |
137 |
| - Name="DateTimePickerPickerVisibility" |
138 |
| - Grid.Row="1" |
139 |
| - Grid.Column="1" |
140 |
| - SelectedItem="{x:Static Controls:TimePartVisibility.All}"> |
| 120 | + <Label Grid.Row="1" |
| 121 | + Grid.Column="0" |
| 122 | + Content="PickerVisibility" /> |
| 123 | + <ComboBox Name="DateTimePickerPickerVisibility" |
| 124 | + Grid.Row="1" |
| 125 | + Grid.Column="1" |
| 126 | + SelectedItem="{x:Static Controls:TimePartVisibility.All}"> |
141 | 127 | <ComboBox.ItemsSource>
|
142 | 128 | <x:Array Type="Controls:TimePartVisibility">
|
143 | 129 | <Controls:TimePartVisibility>All</Controls:TimePartVisibility>
|
|
148 | 134 | </x:Array>
|
149 | 135 | </ComboBox.ItemsSource>
|
150 | 136 | </ComboBox>
|
151 |
| - <Label |
152 |
| - Grid.Row="2" |
153 |
| - Grid.Column="0" |
154 |
| - Content="HandVisibility" /> |
155 |
| - <ComboBox |
156 |
| - Name="DateTimePickerHandVisibility" |
157 |
| - Grid.Row="2" |
158 |
| - Grid.Column="1" |
159 |
| - SelectedItem="{x:Static Controls:TimePartVisibility.All}"> |
| 137 | + <Label Grid.Row="2" |
| 138 | + Grid.Column="0" |
| 139 | + Content="HandVisibility" /> |
| 140 | + <ComboBox Name="DateTimePickerHandVisibility" |
| 141 | + Grid.Row="2" |
| 142 | + Grid.Column="1" |
| 143 | + SelectedItem="{x:Static Controls:TimePartVisibility.All}"> |
160 | 144 | <ComboBox.ItemsSource>
|
161 | 145 | <x:Array Type="Controls:TimePartVisibility">
|
162 | 146 | <Controls:TimePartVisibility>All</Controls:TimePartVisibility>
|
|
167 | 151 | </x:Array>
|
168 | 152 | </ComboBox.ItemsSource>
|
169 | 153 | </ComboBox>
|
170 |
| - <Label |
171 |
| - Grid.Row="3" |
172 |
| - Grid.Column="0" |
173 |
| - Content="CultureInfo" /> |
174 |
| - <ComboBox |
175 |
| - Name="DateTimePickerCulture" |
176 |
| - Grid.Row="3" |
177 |
| - Grid.Column="1" |
178 |
| - VerticalAlignment="Center" |
179 |
| - Controls:TextBoxHelper.ClearTextButton="True" |
180 |
| - DisplayMemberPath="DisplayName" |
181 |
| - ItemsSource="{Binding CultureInfos, Mode=OneWay}" /> |
| 154 | + <Label Grid.Row="3" |
| 155 | + Grid.Column="0" |
| 156 | + Content="CultureInfo" /> |
| 157 | + <ComboBox Name="DateTimePickerCulture" |
| 158 | + Grid.Row="3" |
| 159 | + Grid.Column="1" |
| 160 | + VerticalAlignment="Center" |
| 161 | + Controls:TextBoxHelper.ClearTextButton="True" |
| 162 | + DisplayMemberPath="DisplayName" |
| 163 | + ItemsSource="{Binding CultureInfos, Mode=OneWay}" /> |
182 | 164 | </Grid>
|
183 |
| - <Controls:DateTimePicker |
184 |
| - Controls:TextBoxHelper.UseFloatingWatermark="True" |
185 |
| - Culture="{Binding Path=SelectedItem, ElementName=DateTimePickerCulture, TargetNullValue={x:Static globalization:CultureInfo.CurrentCulture}}" |
186 |
| - HandVisibility="{Binding Path=SelectedItem, ElementName=DateTimePickerHandVisibility, Mode=TwoWay}" |
187 |
| - IsClockVisible="{Binding Path=IsChecked, ElementName=DateTimePickerIsClockVisible, Mode=TwoWay}" |
188 |
| - IsEnabled="{Binding Path=IsChecked, ElementName=DateTimePickerIsEnabled, Mode=TwoWay}" |
189 |
| - IsReadOnly="{Binding Path=IsChecked, ElementName=DateTimePickerIsReadOnly, Mode=TwoWay}" |
190 |
| - Orientation="{Binding Path=SelectedItem, ElementName=DateTimePickerOrientation, Mode=TwoWay}" |
191 |
| - PickerVisibility="{Binding Path=SelectedItem, ElementName=DateTimePickerPickerVisibility, Mode=TwoWay}" /> |
| 165 | + <Controls:DateTimePicker Controls:TextBoxHelper.UseFloatingWatermark="True" |
| 166 | + Culture="{Binding Path=SelectedItem, ElementName=DateTimePickerCulture, TargetNullValue={x:Static globalization:CultureInfo.CurrentCulture}}" |
| 167 | + HandVisibility="{Binding Path=SelectedItem, ElementName=DateTimePickerHandVisibility, Mode=TwoWay}" |
| 168 | + IsClockVisible="{Binding Path=IsChecked, ElementName=DateTimePickerIsClockVisible, Mode=TwoWay}" |
| 169 | + IsEnabled="{Binding Path=IsChecked, ElementName=DateTimePickerIsEnabled, Mode=TwoWay}" |
| 170 | + IsReadOnly="{Binding Path=IsChecked, ElementName=DateTimePickerIsReadOnly, Mode=TwoWay}" |
| 171 | + Orientation="{Binding Path=SelectedItem, ElementName=DateTimePickerOrientation, Mode=TwoWay}" |
| 172 | + PickerVisibility="{Binding Path=SelectedItem, ElementName=DateTimePickerPickerVisibility, Mode=TwoWay}" /> |
192 | 173 | <GroupBox Header="Current time">
|
193 | 174 | <StackPanel>
|
194 |
| - <Controls:DateTimePicker |
195 |
| - x:Name="DateTimePicker" |
196 |
| - Culture="{Binding Path=SelectedItem, ElementName=DateTimePickerCulture, TargetNullValue={x:Static globalization:CultureInfo.CurrentCulture}}" |
197 |
| - HandVisibility="{Binding Path=SelectedItem, ElementName=DateTimePickerHandVisibility, Mode=TwoWay}" |
198 |
| - IsClockVisible="{Binding Path=IsChecked, ElementName=DateTimePickerIsClockVisible, Mode=TwoWay}" |
199 |
| - IsEnabled="{Binding Path=IsChecked, ElementName=DateTimePickerIsEnabled, Mode=TwoWay}" |
200 |
| - IsReadOnly="{Binding Path=IsChecked, ElementName=DateTimePickerIsReadOnly, Mode=TwoWay}" |
201 |
| - Orientation="{Binding Path=SelectedItem, ElementName=DateTimePickerOrientation, Mode=TwoWay}" |
202 |
| - PickerVisibility="{Binding Path=SelectedItem, ElementName=DateTimePickerPickerVisibility, Mode=TwoWay}"> |
| 175 | + <Controls:DateTimePicker x:Name="DateTimePicker" |
| 176 | + Culture="{Binding Path=SelectedItem, ElementName=DateTimePickerCulture, TargetNullValue={x:Static globalization:CultureInfo.CurrentCulture}}" |
| 177 | + HandVisibility="{Binding Path=SelectedItem, ElementName=DateTimePickerHandVisibility, Mode=TwoWay}" |
| 178 | + IsClockVisible="{Binding Path=IsChecked, ElementName=DateTimePickerIsClockVisible, Mode=TwoWay}" |
| 179 | + IsEnabled="{Binding Path=IsChecked, ElementName=DateTimePickerIsEnabled, Mode=TwoWay}" |
| 180 | + IsReadOnly="{Binding Path=IsChecked, ElementName=DateTimePickerIsReadOnly, Mode=TwoWay}" |
| 181 | + Orientation="{Binding Path=SelectedItem, ElementName=DateTimePickerOrientation, Mode=TwoWay}" |
| 182 | + PickerVisibility="{Binding Path=SelectedItem, ElementName=DateTimePickerPickerVisibility, Mode=TwoWay}"> |
203 | 183 | <i:Interaction.Behaviors>
|
204 | 184 | <behaviors:DateTimeNowBehavior />
|
205 | 185 | </i:Interaction.Behaviors>
|
206 | 186 | </Controls:DateTimePicker>
|
207 |
| - <Controls:TimePicker |
208 |
| - Culture="{Binding Path=SelectedItem, ElementName=DateTimePickerCulture, TargetNullValue={x:Static globalization:CultureInfo.CurrentCulture}}" |
209 |
| - HandVisibility="{Binding Path=SelectedItem, ElementName=DateTimePickerHandVisibility, Mode=TwoWay}" |
210 |
| - IsEnabled="{Binding Path=IsChecked, ElementName=DateTimePickerIsEnabled, Mode=TwoWay}" |
211 |
| - IsReadOnly="{Binding Path=IsChecked, ElementName=DateTimePickerIsReadOnly, Mode=TwoWay}" |
212 |
| - PickerVisibility="{Binding Path=SelectedItem, ElementName=DateTimePickerPickerVisibility, Mode=TwoWay}" |
213 |
| - SelectedTime="{Binding Path=SelectedTime, ElementName=DateTimePicker}" /> |
| 187 | + <Controls:TimePicker Culture="{Binding Path=SelectedItem, ElementName=DateTimePickerCulture, TargetNullValue={x:Static globalization:CultureInfo.CurrentCulture}}" |
| 188 | + HandVisibility="{Binding Path=SelectedItem, ElementName=DateTimePickerHandVisibility, Mode=TwoWay}" |
| 189 | + IsEnabled="{Binding Path=IsChecked, ElementName=DateTimePickerIsEnabled, Mode=TwoWay}" |
| 190 | + IsReadOnly="{Binding Path=IsChecked, ElementName=DateTimePickerIsReadOnly, Mode=TwoWay}" |
| 191 | + PickerVisibility="{Binding Path=SelectedItem, ElementName=DateTimePickerPickerVisibility, Mode=TwoWay}" |
| 192 | + SelectedTime="{Binding Path=SelectedTime, ElementName=DateTimePicker}" /> |
214 | 193 | </StackPanel>
|
215 | 194 | </GroupBox>
|
216 | 195 | </StackPanel>
|
|
0 commit comments