|
5 | 5 | xmlns:local="clr-namespace:iNKORE.UI.WPF.Modern.Controls" |
6 | 6 | xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf" |
7 | 7 | xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern" |
8 | | - xmlns:common="clr-namespace:iNKORE.UI.WPF.Modern.Common;assembly=iNKORE.UI.WPF.Modern"> |
| 8 | + xmlns:common="clr-namespace:iNKORE.UI.WPF.Modern.Common;assembly=iNKORE.UI.WPF.Modern" |
| 9 | + xmlns:sys="clr-namespace:System;assembly=netstandard"> |
9 | 10 |
|
10 | 11 | <ResourceDictionary.MergedDictionaries> |
11 | 12 | <ResourceDictionary Source="/iNKORE.UI.WPF.Modern;component/Themes/Controls/RepeatButton.xaml" /> |
|
19 | 20 | <ikw:CornerRadiusFilterConverter x:Key="BottomCornerRadiusFilterConverter" Filter="Bottom" /> |
20 | 21 | <ikw:CornerRadiusFilterConverter x:Key="LeftCornerRadiusFilterConverter" Filter="Left" /> |
21 | 22 |
|
| 23 | + <sys:Double x:Key="NumberBoxMinWidth">120</sys:Double> |
22 | 24 | <Thickness x:Key="NumberBoxPopupIndicatorMargin">0,0,8,0</Thickness> |
23 | 25 |
|
24 | 26 | <Style |
|
27 | 29 | TargetType="RepeatButton"> |
28 | 30 | <Style.Setters> |
29 | 31 | <Setter Property="IsTabStop" Value="False" /> |
30 | | - <Setter Property="MinWidth" Value="34" /> |
| 32 | + <Setter Property="MinWidth" Value="32" /> |
| 33 | + <Setter Property="Padding" Value="0" /> |
31 | 34 | <Setter Property="VerticalAlignment" Value="Stretch" /> |
32 | | - <Setter Property="Background" Value="{DynamicResource TextControlBackground}" /> |
| 35 | + <Setter Property="FontSize" Value="12" /> |
| 36 | + <Setter Property="Background" Value="Transparent" /> |
33 | 37 | <Setter Property="BorderBrush" Value="{DynamicResource TextControlBorderBrush}" /> |
34 | 38 | <Setter Property="BorderThickness" Value="{DynamicResource NumberBoxSpinButtonBorderThickness}" /> |
35 | 39 | <Setter Property="FontFamily" Value="{DynamicResource SymbolThemeFontFamily}" /> |
|
45 | 49 |
|
46 | 50 | <Style |
47 | 51 | x:Key="NumberBoxPopupSpinButtonStyle" |
48 | | - BasedOn="{StaticResource DefaultRepeatButtonStyle}" |
| 52 | + BasedOn="{StaticResource NumberBoxSpinButtonStyle}" |
49 | 53 | TargetType="RepeatButton"> |
50 | 54 | <Style.Setters> |
51 | 55 | <Setter Property="Focusable" Value="False" /> |
52 | | - <Setter Property="Width" Value="40" /> |
53 | | - <Setter Property="Height" Value="32" /> |
54 | | - <Setter Property="Background" Value="{DynamicResource NumberBoxPopupSpinButtonBackground}" /> |
| 56 | + <Setter Property="Width" Value="36" /> |
| 57 | + <Setter Property="Height" Value="36" /> |
| 58 | + <Setter Property="Padding" Value="0" /> |
55 | 59 | <Setter Property="BorderThickness" Value="{DynamicResource NumberBoxPopupSpinButtonBorderThickness}" /> |
| 60 | + <Setter Property="FontSize" Value="16" /> |
56 | 61 | <Setter Property="FontFamily" Value="{DynamicResource SymbolThemeFontFamily}" /> |
| 62 | + <Setter Property="ui:ControlHelper.CornerRadius" Value="{DynamicResource ControlCornerRadius}" /> |
57 | 63 | <Setter Property="ContentTemplate"> |
58 | 64 | <Setter.Value> |
59 | 65 | <DataTemplate> |
|
82 | 88 | </ControlTemplate.Resources> |
83 | 89 | <Border |
84 | 90 | x:Name="ButtonLayoutGrid" |
85 | | - Background="{DynamicResource TextControlButtonBackground}" |
| 91 | + Margin="{DynamicResource TextBoxInnerButtonMargin}" |
| 92 | + Background="Transparent" |
86 | 93 | BorderBrush="{DynamicResource TextControlButtonBorderBrush}" |
87 | 94 | BorderThickness="{TemplateBinding BorderThickness}" |
88 | 95 | CornerRadius="{TemplateBinding ui:ControlHelper.CornerRadius}"> |
|
92 | 99 | VerticalAlignment="Center" |
93 | 100 | Data="{StaticResource Cancel}" |
94 | 101 | FontFamily="{DynamicResource SymbolThemeFontFamily}" |
95 | | - FontSize="12" |
| 102 | + FontSize="{DynamicResource TextBoxIconFontSize}" |
96 | 103 | FontStyle="Normal" |
97 | 104 | Foreground="{DynamicResource TextControlButtonForeground}" /> |
98 | 105 | </Border> |
|
125 | 132 | <Grid.ColumnDefinitions> |
126 | 133 | <ColumnDefinition Width="*" /> |
127 | 134 | <ColumnDefinition Width="Auto" /> |
128 | | - <ColumnDefinition Width="Auto" /> |
| 135 | + <ColumnDefinition x:Name="SpinButtonsColumn" Width="Auto" /> |
129 | 136 | </Grid.ColumnDefinitions> |
130 | 137 | <ui:ContentPresenterEx |
131 | 138 | x:Name="HeaderContentPresenter" |
|
204 | 211 | TextElement.Foreground="{DynamicResource SystemControlDescriptionTextForegroundBrush}" |
205 | 212 | Visibility="{TemplateBinding ui:ControlHelper.DescriptionVisibility}" /> |
206 | 213 | <ui:FontIconFallback |
| 214 | + x:Name="PopupIndicator" |
207 | 215 | Grid.Row="1" |
208 | 216 | Grid.Column="2" |
209 | 217 | Margin="{StaticResource NumberBoxPopupIndicatorMargin}" |
|
212 | 220 | Data="{StaticResource ScrollUpDown}" |
213 | 221 | FontFamily="{DynamicResource SymbolThemeFontFamily}" |
214 | 222 | FontSize="12" |
| 223 | + Visibility="Collapsed" |
215 | 224 | Foreground="{DynamicResource NumberBoxPopupIndicatorForeground}" /> |
216 | 225 | <VisualStateManager.VisualStateGroups> |
217 | 226 | <VisualStateGroup x:Name="ButtonStates"> |
|
227 | 236 | </VisualStateManager.VisualStateGroups> |
228 | 237 | </Grid> |
229 | 238 | <ControlTemplate.Triggers> |
| 239 | + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=local:NumberBox}, Path=SpinButtonPlacementMode, Mode=OneWay}" Value="Inline"> |
| 240 | + <Setter TargetName="SpinButtonsColumn" Property="Width" Value="72"/> |
| 241 | + </DataTrigger> |
| 242 | + |
| 243 | + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=local:NumberBox}, Path=SpinButtonPlacementMode, Mode=OneWay}" Value="Compact"> |
| 244 | + <Setter TargetName="PopupIndicator" Property="Visibility" Value="Visible"/> |
| 245 | + </DataTrigger> |
| 246 | + |
230 | 247 | <Trigger Property="ui:ControlHelper.PlaceholderForeground" Value="{x:Null}"> |
231 | 248 | <Setter TargetName="PlaceholderTextContentPresenter" Property="Foreground" Value="{DynamicResource TextControlPlaceholderForeground}" /> |
232 | 249 | </Trigger> |
|
271 | 288 |
|
272 | 289 | <Style TargetType="local:NumberBox"> |
273 | 290 | <Setter Property="IsTabStop" Value="False" /> |
| 291 | + <Setter Property="VerticalAlignment" Value="Top" /> |
| 292 | + <Setter Property="HorizontalAlignment" Value="Left" /> |
| 293 | + <Setter Property="Background" Value="{DynamicResource TextControlBackground}" /> |
| 294 | + <Setter Property="BorderThickness" Value="{DynamicResource TextControlBorderThemeThickness}" /> |
| 295 | + <Setter Property="BorderBrush" Value="{DynamicResource TextControlBorderBrush}" /> |
| 296 | + <Setter Property="Foreground" Value="{DynamicResource TextControlForeground}" /> |
274 | 297 | <Setter Property="SelectionBrush" Value="{DynamicResource TextControlSelectionHighlightColor}" /> |
275 | 298 | <Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" /> |
276 | 299 | <Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" /> |
277 | 300 | <Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" /> |
| 301 | + <Setter Property="Padding" Value="{DynamicResource TextControlThemePadding}" /> |
278 | 302 | <Setter Property="FocusVisualStyle" Value="{x:Null}" /> |
279 | 303 | <Setter Property="Template"> |
280 | 304 | <Setter.Value> |
|
284 | 308 | <StreamGeometry x:Key="ChevronUp">M 19.091797 14.970703 L 10 5.888672 L 0.908203 14.970703 L 0.029297 14.091797 L 10 4.111328 L 19.970703 14.091797 Z</StreamGeometry> |
285 | 309 | </ControlTemplate.Resources> |
286 | 310 |
|
287 | | - <Grid ui:ThemeManager.HasThemeResources="True"> |
| 311 | + <Grid ui:ThemeManager.HasThemeResources="True" Height="{TemplateBinding Height}"> |
288 | 312 | <Grid.Resources> |
289 | 313 | <ui:ResourceDictionaryEx> |
290 | 314 | <!--<ui:ResourceDictionaryEx.ThemeDictionaries> |
|
306 | 330 | <ui:StaticResource x:Key="RepeatButtonBorderBrushPointerOver" ResourceKey="TextControlBorderBrush" /> |
307 | 331 | <ui:StaticResource x:Key="RepeatButtonBorderBrushPressed" ResourceKey="TextControlBorderBrush" /> |
308 | 332 |
|
309 | | - |
| 333 | + |
310 | 334 | </ui:ResourceDictionaryEx> |
311 | 335 | </Grid.Resources> |
312 | 336 |
|
313 | 337 | <Grid.RowDefinitions> |
314 | 338 | <RowDefinition Height="Auto" /> |
315 | | - <RowDefinition Height="Auto" /> |
| 339 | + <RowDefinition Height="*" /> |
316 | 340 | <RowDefinition Height="Auto" /> |
317 | 341 | </Grid.RowDefinitions> |
318 | 342 |
|
|
340 | 364 | <TextBox |
341 | 365 | x:Name="InputBox" |
342 | 366 | Grid.Row="1" |
| 367 | + Grid.ColumnSpan="3" |
343 | 368 | ui:ControlHelper.CornerRadius="{TemplateBinding CornerRadius}" |
344 | 369 | ui:ControlHelper.PlaceholderText="{TemplateBinding PlaceholderText}" |
345 | 370 | FontFamily="{TemplateBinding FontFamily}" |
346 | 371 | FontSize="{TemplateBinding FontSize}" |
347 | 372 | FontWeight="{TemplateBinding FontWeight}" |
348 | 373 | InputScope="{TemplateBinding InputScope}" |
349 | 374 | SelectionBrush="{TemplateBinding SelectionBrush}" |
350 | | - TextAlignment="{TemplateBinding TextAlignment}" /> |
| 375 | + Background="{TemplateBinding Background}" |
| 376 | + BorderThickness="{TemplateBinding BorderThickness}" |
| 377 | + BorderBrush="{TemplateBinding BorderBrush}" |
| 378 | + Padding="{TemplateBinding Padding}" |
| 379 | + Foreground="{TemplateBinding Foreground}" |
| 380 | + TextAlignment="{TemplateBinding TextAlignment}" |
| 381 | + Style="{StaticResource NumberBoxTextBoxStyle}"/> |
351 | 382 |
|
352 | 383 | <Popup |
353 | 384 | x:Name="UpDownPopup" |
|
365 | 396 | IsShadowEnabled="{DynamicResource {x:Static SystemParameters.DropShadowKey}}"> |
366 | 397 | <Border |
367 | 398 | x:Name="PopupContentRoot" |
| 399 | + Padding="6" |
368 | 400 | Background="{DynamicResource NumberBoxPopupBackground}" |
369 | 401 | BorderBrush="{DynamicResource NumberBoxPopupBorderBrush}" |
370 | 402 | BorderThickness="{DynamicResource NumberBoxPopupBorderThickness}" |
|
379 | 411 | <RepeatButton |
380 | 412 | x:Name="PopupUpSpinButton" |
381 | 413 | Content="{StaticResource ChevronUp}" |
| 414 | + Margin="0,0,0,4" |
382 | 415 | Style="{StaticResource NumberBoxPopupSpinButtonStyle}" /> |
383 | 416 |
|
384 | 417 | <RepeatButton |
|
391 | 424 | </ui:ThemeShadowChrome> |
392 | 425 | </Popup> |
393 | 426 |
|
| 427 | + <Button x:Name="InputEater" |
| 428 | + Grid.Row="1" |
| 429 | + Grid.Column="1" |
| 430 | + Grid.ColumnSpan="2" |
| 431 | + Visibility="Collapsed" |
| 432 | + HorizontalAlignment="Stretch" |
| 433 | + VerticalAlignment="Stretch" |
| 434 | + Margin="4,0,0,0" |
| 435 | + IsTabStop="False"> |
| 436 | + <Button.Template> |
| 437 | + <ControlTemplate TargetType="Button"> |
| 438 | + <Grid Background="Transparent" /> |
| 439 | + </ControlTemplate> |
| 440 | + </Button.Template> |
| 441 | + </Button> |
| 442 | + |
394 | 443 | <RepeatButton |
395 | 444 | x:Name="UpSpinButton" |
396 | 445 | Grid.Row="1" |
397 | 446 | Grid.Column="1" |
398 | | - ui:ControlHelper.CornerRadius="0" |
| 447 | + Margin="4" |
| 448 | + ui:ControlHelper.CornerRadius="{TemplateBinding CornerRadius}" |
399 | 449 | Content="{StaticResource ChevronUp}" |
400 | 450 | FontSize="{TemplateBinding FontSize}" |
401 | 451 | Style="{StaticResource NumberBoxSpinButtonStyle}" |
|
405 | 455 | x:Name="DownSpinButton" |
406 | 456 | Grid.Row="1" |
407 | 457 | Grid.Column="2" |
408 | | - ui:ControlHelper.CornerRadius="{TemplateBinding CornerRadius, |
409 | | - Converter={StaticResource RightCornerRadiusFilterConverter}}" |
| 458 | + ui:ControlHelper.CornerRadius="{TemplateBinding CornerRadius}" |
| 459 | + Margin="0,4,4,4" |
410 | 460 | Content="{StaticResource ChevronDown}" |
411 | 461 | FontSize="{TemplateBinding FontSize}" |
412 | 462 | Style="{StaticResource NumberBoxSpinButtonStyle}" |
|
415 | 465 | <ContentPresenter |
416 | 466 | x:Name="DescriptionPresenter" |
417 | 467 | Grid.Row="2" |
418 | | - Grid.ColumnSpan="2" |
| 468 | + Grid.ColumnSpan="3" |
419 | 469 | Content="{TemplateBinding Description}" |
420 | 470 | SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" |
421 | 471 | TextElement.Foreground="{DynamicResource SystemControlDescriptionTextForegroundBrush}" |
|
461 | 511 | </VisualStateManager.VisualStateGroups> |
462 | 512 | </Grid> |
463 | 513 | <ControlTemplate.Triggers> |
464 | | - <Trigger Property="IsEnabled" Value="false"> |
| 514 | + <Trigger Property="IsEnabled" Value="False"> |
465 | 515 | <Setter TargetName="HeaderContentPresenter" Property="Foreground" Value="{DynamicResource TextControlHeaderForegroundDisabled}" /> |
466 | 516 | </Trigger> |
467 | 517 | <!-- SpinButtonsVisible --> |
468 | 518 | <Trigger Property="SpinButtonPlacementMode" Value="Inline"> |
469 | 519 | <Setter TargetName="DownSpinButton" Property="Visibility" Value="Visible" /> |
470 | 520 | <Setter TargetName="UpSpinButton" Property="Visibility" Value="Visible" /> |
471 | | - <Setter TargetName="InputBox" Property="ui:ControlHelper.CornerRadius" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CornerRadius, Converter={StaticResource LeftCornerRadiusFilterConverter}}" /> |
| 521 | + <Setter TargetName="InputEater" Property="Visibility" Value="Visible" /> |
| 522 | + <!--<Setter TargetName="InputBox" Property="ui:ControlHelper.CornerRadius" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CornerRadius, Converter={StaticResource LeftCornerRadiusFilterConverter}}" />--> |
| 523 | + <Setter TargetName="InputBox" Property="MinWidth" Value="{StaticResource NumberBoxMinWidth}" /> |
472 | 524 | </Trigger> |
473 | 525 | <!-- SpinButtonsPopup --> |
474 | 526 | <Trigger Property="SpinButtonPlacementMode" Value="Compact"> |
|
0 commit comments