Browse Source

Port default theme to use ControlThemes + some formatting

pull/8625/head
Max Katz 4 years ago
parent
commit
707b7af6b3
  1. 36
      src/Avalonia.Themes.Default/Controls/AutoCompleteBox.xaml
  2. 54
      src/Avalonia.Themes.Default/Controls/Button.xaml
  3. 188
      src/Avalonia.Themes.Default/Controls/ButtonSpinner.xaml
  4. 24
      src/Avalonia.Themes.Default/Controls/Calendar.xaml
  5. 90
      src/Avalonia.Themes.Default/Controls/CalendarButton.xaml
  6. 136
      src/Avalonia.Themes.Default/Controls/CalendarDatePicker.xaml
  7. 149
      src/Avalonia.Themes.Default/Controls/CalendarDayButton.xaml
  8. 139
      src/Avalonia.Themes.Default/Controls/CalendarItem.xaml
  9. 153
      src/Avalonia.Themes.Default/Controls/CaptionButtons.xaml
  10. 38
      src/Avalonia.Themes.Default/Controls/Carousel.xaml
  11. 95
      src/Avalonia.Themes.Default/Controls/CheckBox.xaml
  12. 81
      src/Avalonia.Themes.Default/Controls/ComboBox.xaml
  13. 63
      src/Avalonia.Themes.Default/Controls/ComboBoxItem.xaml
  14. 36
      src/Avalonia.Themes.Default/Controls/ContentControl.xaml
  15. 46
      src/Avalonia.Themes.Default/Controls/ContextMenu.xaml
  16. 91
      src/Avalonia.Themes.Default/Controls/DataValidationErrors.xaml
  17. 496
      src/Avalonia.Themes.Default/Controls/DatePicker.xaml
  18. 139
      src/Avalonia.Themes.Default/Controls/DateTimePickerShared.xaml
  19. 70
      src/Avalonia.Themes.Default/Controls/DropDownButton.xaml
  20. 43
      src/Avalonia.Themes.Default/Controls/EmbeddableControlRoot.xaml
  21. 382
      src/Avalonia.Themes.Default/Controls/Expander.xaml
  22. 20
      src/Avalonia.Themes.Default/Controls/FlyoutPresenter.xaml
  23. 9
      src/Avalonia.Themes.Default/Controls/FocusAdorner.xaml
  24. 21
      src/Avalonia.Themes.Default/Controls/GridSplitter.xaml
  25. 36
      src/Avalonia.Themes.Default/Controls/ItemsControl.xaml
  26. 40
      src/Avalonia.Themes.Default/Controls/Label.xaml
  27. 71
      src/Avalonia.Themes.Default/Controls/ListBox.xaml
  28. 66
      src/Avalonia.Themes.Default/Controls/ListBoxItem.xaml
  29. 319
      src/Avalonia.Themes.Default/Controls/ManagedFileChooser.xaml
  30. 100
      src/Avalonia.Themes.Default/Controls/Menu.xaml
  31. 21
      src/Avalonia.Themes.Default/Controls/MenuFlyoutPresenter.xaml
  32. 163
      src/Avalonia.Themes.Default/Controls/MenuItem.xaml
  33. 60
      src/Avalonia.Themes.Default/Controls/NativeMenuBar.xaml
  34. 171
      src/Avalonia.Themes.Default/Controls/NotificationCard.xaml
  35. 49
      src/Avalonia.Themes.Default/Controls/NumericUpDown.xaml
  36. 48
      src/Avalonia.Themes.Default/Controls/OverlayPopupHost.xaml
  37. 21
      src/Avalonia.Themes.Default/Controls/PathIcon.xaml
  38. 57
      src/Avalonia.Themes.Default/Controls/PopupRoot.xaml
  39. 155
      src/Avalonia.Themes.Default/Controls/ProgressBar.xaml
  40. 87
      src/Avalonia.Themes.Default/Controls/RadioButton.xaml
  41. 71
      src/Avalonia.Themes.Default/Controls/RepeatButton.xaml
  42. 18
      src/Avalonia.Themes.Default/Controls/RichTextBlock.xaml
  43. 283
      src/Avalonia.Themes.Default/Controls/ScrollBar.xaml
  44. 133
      src/Avalonia.Themes.Default/Controls/ScrollViewer.xaml
  45. 28
      src/Avalonia.Themes.Default/Controls/Separator.xaml
  46. 213
      src/Avalonia.Themes.Default/Controls/Slider.xaml
  47. 444
      src/Avalonia.Themes.Default/Controls/SplitButton.xaml
  48. 451
      src/Avalonia.Themes.Default/Controls/SplitView.xaml
  49. 101
      src/Avalonia.Themes.Default/Controls/TabControl.xaml
  50. 91
      src/Avalonia.Themes.Default/Controls/TabItem.xaml
  51. 17
      src/Avalonia.Themes.Default/Controls/TabStrip.xaml
  52. 33
      src/Avalonia.Themes.Default/Controls/TabStripItem.xaml
  53. 338
      src/Avalonia.Themes.Default/Controls/TextBox.xaml
  54. 467
      src/Avalonia.Themes.Default/Controls/TimePicker.xaml
  55. 80
      src/Avalonia.Themes.Default/Controls/TitleBar.xaml
  56. 62
      src/Avalonia.Themes.Default/Controls/ToggleButton.xaml
  57. 483
      src/Avalonia.Themes.Default/Controls/ToggleSwitch.xaml
  58. 40
      src/Avalonia.Themes.Default/Controls/ToolTip.xaml
  59. 23
      src/Avalonia.Themes.Default/Controls/TransitioningContentControl.xaml
  60. 58
      src/Avalonia.Themes.Default/Controls/TreeView.xaml
  61. 159
      src/Avalonia.Themes.Default/Controls/TreeViewItem.xaml
  62. 39
      src/Avalonia.Themes.Default/Controls/UserControl.xaml
  63. 59
      src/Avalonia.Themes.Default/Controls/Window.xaml
  64. 81
      src/Avalonia.Themes.Default/Controls/WindowNotificationManager.xaml
  65. 143
      src/Avalonia.Themes.Default/DefaultTheme.xaml

36
src/Avalonia.Themes.Default/Controls/AutoCompleteBox.xaml

@ -1,32 +1,34 @@
<Styles xmlns="https://github.com/avaloniaui"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Style Selector="AutoCompleteBox"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}"/> <ControlTheme x:Key="{x:Type AutoCompleteBox}"
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/> TargetType="AutoCompleteBox">
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}"/> <Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
<Setter Property="Padding" Value="4"/> <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" />
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}" />
<Setter Property="Padding" Value="4" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Panel> <Panel>
<TextBox Name="PART_TextBox" <TextBox Name="PART_TextBox"
Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}"
BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}" CornerRadius="{TemplateBinding CornerRadius}"
Padding="{TemplateBinding Padding}" DataValidationErrors.Errors="{TemplateBinding (DataValidationErrors.Errors)}"
Watermark="{TemplateBinding Watermark}" Watermark="{TemplateBinding Watermark}" />
DataValidationErrors.Errors="{TemplateBinding (DataValidationErrors.Errors)}" />
<Popup Name="PART_Popup" <Popup Name="PART_Popup"
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}" MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
MaxHeight="{TemplateBinding MaxDropDownHeight}" MaxHeight="{TemplateBinding MaxDropDownHeight}"
PlacementTarget="{TemplateBinding}" IsLightDismissEnabled="True"
IsLightDismissEnabled="True"> PlacementTarget="{TemplateBinding}">
<Border Background="{DynamicResource ThemeBackgroundBrush}" <Border Background="{DynamicResource ThemeBackgroundBrush}"
BorderBrush="{DynamicResource ThemeBorderMidBrush}" BorderBrush="{DynamicResource ThemeBorderMidBrush}"
BorderThickness="1"> BorderThickness="1">
<ListBox Name="PART_SelectingItemsControl" <ListBox Name="PART_SelectingItemsControl"
BorderThickness="0"
Background="{TemplateBinding Background}" Background="{TemplateBinding Background}"
BorderThickness="0"
Foreground="{TemplateBinding Foreground}" Foreground="{TemplateBinding Foreground}"
ItemTemplate="{TemplateBinding ItemTemplate}" ItemTemplate="{TemplateBinding ItemTemplate}"
ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto"
@ -36,5 +38,5 @@
</Panel> </Panel>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style> </ControlTheme>
</Styles> </ResourceDictionary>

54
src/Avalonia.Themes.Default/Controls/Button.xaml

@ -1,36 +1,38 @@
<Styles xmlns="https://github.com/avaloniaui"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Style Selector="Button"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Setter Property="Background" Value="{DynamicResource ThemeControlMidBrush}"/> <ControlTheme x:Key="{x:Type Button}"
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderLowBrush}"/> TargetType="Button">
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}"/> <Setter Property="Background" Value="{DynamicResource ThemeControlMidBrush}" />
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}"/> <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderLowBrush}" />
<Setter Property="HorizontalContentAlignment" Value="Center"/> <Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}" />
<Setter Property="VerticalContentAlignment" Value="Center"/> <Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" />
<Setter Property="Padding" Value="4"/> <Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Padding" Value="4" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<ContentPresenter Name="PART_ContentPresenter" <ContentPresenter Name="PART_ContentPresenter"
Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Background="{TemplateBinding Background}" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding Content}" Content="{TemplateBinding Content}"
Padding="{TemplateBinding Padding}" ContentTemplate="{TemplateBinding ContentTemplate}"
CornerRadius="{TemplateBinding CornerRadius}"
RecognizesAccessKey="True" RecognizesAccessKey="True"
TextElement.Foreground="{TemplateBinding Foreground}" TextElement.Foreground="{TemplateBinding Foreground}" />
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style> <Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Style Selector="Button:pointerover /template/ ContentPresenter"> <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/> </Style>
</Style> <Style Selector="^:pressed /template/ ContentPresenter#PART_ContentPresenter">
<Style Selector="Button:pressed /template/ ContentPresenter"> <Setter Property="Background" Value="{DynamicResource ThemeControlHighBrush}" />
<Setter Property="Background" Value="{DynamicResource ThemeControlHighBrush}"/> </Style>
</Style> <Style Selector="^:disabled">
<Style Selector="Button:disabled"> <Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}"/> </Style>
</Style> </ControlTheme>
</Styles> </ResourceDictionary>

188
src/Avalonia.Themes.Default/Controls/ButtonSpinner.xaml

@ -1,107 +1,89 @@
<Styles xmlns="https://github.com/avaloniaui"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Style Selector="ButtonSpinner"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
<Setter Property="Background" Value="Transparent"/> x:CompileBindings="True">
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/>
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}"/> <ControlTheme x:Key="DefaultButtonSpinnerRepeatButton"
<Setter Property="HorizontalContentAlignment" Value="Stretch"/> BasedOn="{StaticResource {x:Type RepeatButton}}"
<Setter Property="VerticalContentAlignment" Value="Center"/> TargetType="RepeatButton">
<Setter Property="Focusable" Value="True"/> <Setter Property="Background" Value="Transparent" />
</Style> <Setter Property="BorderBrush" Value="Transparent" />
<Style Selector="ButtonSpinner /template/ RepeatButton"> <Style Selector="^ /template/ RepeatButton:pointerover">
<Setter Property="Background" Value="Transparent"/> <Setter Property="Background" Value="{DynamicResource ThemeControlMidBrush}" />
<Setter Property="BorderBrush" Value="Transparent"/> <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" />
</Style> </Style>
<Style Selector="ButtonSpinner /template/ RepeatButton:pointerover"> </ControlTheme>
<Setter Property="Background" Value="{DynamicResource ThemeControlMidBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/> <ControlTheme x:Key="{x:Type ButtonSpinner}"
</Style> TargetType="ButtonSpinner">
<Style Selector="ButtonSpinner /template/ RepeatButton#PART_IncreaseButton"> <Setter Property="Background" Value="Transparent" />
<Setter Property="Content"> <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" />
<Template> <Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}" />
<Path Fill="{DynamicResource ThemeForegroundBrush}" <Setter Property="HorizontalContentAlignment" Value="Stretch" />
Width="8" <Setter Property="VerticalContentAlignment" Value="Center" />
Height="4" <Setter Property="Focusable" Value="True" />
Stretch="Uniform"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="M0,5 L4.5,.5 9,5 6,5 4.5,3.5 3,5 z"/>
</Template>
</Setter>
</Style>
<Style Selector="ButtonSpinner /template/ RepeatButton#PART_DecreaseButton">
<Setter Property="Content">
<Template>
<Path Fill="{DynamicResource ThemeForegroundBrush}"
Width="8"
Height="4"
Stretch="Uniform"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="M0,0 L3,0 4.5,1.5 6,0 9,0 4.5,4.5 z"/>
</Template>
</Setter>
</Style>
<Style Selector="ButtonSpinner:right">
<Setter Property="Template">
<ControlTemplate>
<Border Name="border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="{TemplateBinding VerticalAlignment}">
<Grid ColumnDefinitions="*,Auto">
<ContentPresenter Name="PART_ContentPresenter" Grid.Column="0"
ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding Content}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Padding="{TemplateBinding Padding}"/>
<Grid Grid.Column="1" RowDefinitions="*,*" IsVisible="{TemplateBinding ShowButtonSpinner}">
<RepeatButton Grid.Row="0" Name="PART_IncreaseButton"/>
<RepeatButton Grid.Row="1" Name="PART_DecreaseButton"/>
</Grid>
</Grid>
</Border>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="ButtonSpinner:left">
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Border Name="border" <DataValidationErrors>
Background="{TemplateBinding Background}" <Border Name="border"
BorderBrush="{TemplateBinding BorderBrush}" Margin="{TemplateBinding Padding}"
BorderThickness="{TemplateBinding BorderThickness}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
CornerRadius="{TemplateBinding CornerRadius}" VerticalAlignment="{TemplateBinding VerticalAlignment}"
Margin="{TemplateBinding Padding}" Background="{TemplateBinding Background}"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}" BorderBrush="{TemplateBinding BorderBrush}"
VerticalAlignment="{TemplateBinding VerticalAlignment}"> BorderThickness="{TemplateBinding BorderThickness}"
<Grid ColumnDefinitions="Auto,*"> CornerRadius="{TemplateBinding CornerRadius}">
<Grid Grid.Column="0" RowDefinitions="*,*" IsVisible="{TemplateBinding ShowButtonSpinner}"> <DockPanel>
<RepeatButton Grid.Row="0" Name="PART_IncreaseButton"/> <UniformGrid Name="PART_SpinnerPanel"
<RepeatButton Grid.Row="1" Name="PART_DecreaseButton"/> DockPanel.Dock="Right"
</Grid> IsVisible="{TemplateBinding ShowButtonSpinner}"
<ContentPresenter Name="PART_ContentPresenter" Grid.Column="1" Rows="2">
ContentTemplate="{TemplateBinding ContentTemplate}" <RepeatButton Name="PART_IncreaseButton"
Content="{TemplateBinding Content}" Theme="{StaticResource DefaultButtonSpinnerRepeatButton}">
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" <Path Width="8"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" Height="4"
Padding="{TemplateBinding Padding}"/> HorizontalAlignment="Center"
</Grid> VerticalAlignment="Center"
</Border> Data="M0,5 L4.5,.5 9,5 6,5 4.5,3.5 3,5 z"
Fill="{DynamicResource ThemeForegroundBrush}"
Stretch="Uniform" />
</RepeatButton>
<RepeatButton Name="PART_DecreaseButton"
Theme="{StaticResource DefaultButtonSpinnerRepeatButton}">
<Path Width="8"
Height="4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="M0,0 L3,0 4.5,1.5 6,0 9,0 4.5,4.5 z"
Fill="{DynamicResource ThemeForegroundBrush}"
Stretch="Uniform" />
</RepeatButton>
</UniformGrid>
<ContentPresenter Name="PART_ContentPresenter"
Grid.Column="1"
Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}" />
</DockPanel>
</Border>
</DataValidationErrors>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style> <Style Selector="^:left">
<Style Selector="ButtonSpinner:pointerover /template/ Border#border"> <Style Selector="^ /template/ StackPanel#PART_SpinnerPanel">
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderHighBrush}"/> <Setter Property="DockPanel.Dock" Value="Left" />
</Style> </Style>
<Style Selector="ButtonSpinner:focus /template/ Border#border"> </Style>
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderHighBrush}"/> <Style Selector="^:pointerover /template/ Border#border">
</Style> <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderHighBrush}" />
<Style Selector="ButtonSpinner:error /template/ Border#border"> </Style>
<Setter Property="BorderBrush" Value="{DynamicResource ErrorBrush}"/> <Style Selector="^:focus /template/ Border#border">
</Style> <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderHighBrush}" />
</Styles> </Style>
<Style Selector="^:error /template/ Border#border">
<Setter Property="BorderBrush" Value="{DynamicResource ErrorBrush}" />
</Style>
</ControlTheme>
</ResourceDictionary>

24
src/Avalonia.Themes.Default/Controls/Calendar.xaml

@ -1,12 +1,14 @@
<!-- <!--
// (c) Copyright Microsoft Corporation. // (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL). // This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details. // Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved. // All other rights reserved.
--> -->
<Styles xmlns="https://github.com/avaloniaui"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Style Selector="Calendar"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ControlTheme x:Key="{x:Type Calendar}"
TargetType="Calendar">
<!--<Setter Property="Focusable" Value="False" />--> <!--<Setter Property="Focusable" Value="False" />-->
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}" /> <Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}" />
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderHighBrush}" /> <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderHighBrush}" />
@ -17,16 +19,14 @@
<StackPanel Name="Root" <StackPanel Name="Root"
HorizontalAlignment="Center" HorizontalAlignment="Center"
ClipToBounds="True"> ClipToBounds="True">
<CalendarItem Name="CalendarItem"
<CalendarItem Name="CalendarItem"
Background="{TemplateBinding Background}" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}" CornerRadius="{TemplateBinding CornerRadius}"
HeaderBackground="{TemplateBinding HeaderBackground}"/> HeaderBackground="{TemplateBinding HeaderBackground}" />
</StackPanel> </StackPanel>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style> </ControlTheme>
</Styles> </ResourceDictionary>

90
src/Avalonia.Themes.Default/Controls/CalendarButton.xaml

@ -1,81 +1,73 @@
<!-- <!--
// (c) Copyright Microsoft Corporation. // (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL). // This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details. // Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved. // All other rights reserved.
--> -->
<Styles xmlns="https://github.com/avaloniaui"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Style Selector="CalendarButton"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Setter Property="Foreground" Value="{DynamicResource ThemeBorderHighBrush}" /> <ControlTheme x:Key="{x:Type CalendarButton}"
TargetType="CalendarButton">
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" />
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush2}" /> <Setter Property="Background" Value="{DynamicResource ThemeAccentBrush2}" />
<Setter Property="FontSize" Value="{DynamicResource FontSizeSmall}" /> <Setter Property="FontSize" Value="{DynamicResource FontSizeSmall}" />
<Setter Property="HorizontalContentAlignment" Value="Center" /> <Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" /> <Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="MinWidth" Value="37" /> <Setter Property="MinWidth" Value="37" />
<Setter Property="MinHeight" Value="38" /> <Setter Property="MinHeight" Value="38" />
<Setter Property="Focusable" Value="False"/> <Setter Property="Focusable" Value="False" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Grid> <Grid>
<Rectangle Name="SelectedBackground" <Rectangle Name="SelectedBackground"
Opacity="0.75" Fill="{TemplateBinding Background}"
Fill="{TemplateBinding Background}"/> IsVisible="False"
Opacity="0.75" />
<Rectangle Name="Background" <Rectangle Name="Background"
Opacity="0.5" Fill="{TemplateBinding Background}"
Fill="{TemplateBinding Background}"/> IsVisible="False"
Opacity="0.5" />
<!--Focusable="False"--> <!-- Focusable="False" -->
<ContentControl Name="Content" <ContentControl Name="Content"
Foreground="{TemplateBinding Foreground}" Margin="1,0,1,1"
ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding Content}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
FontSize="{TemplateBinding FontSize}" FontSize="{TemplateBinding FontSize}"
Margin="1,0,1,1"/> Foreground="{TemplateBinding Foreground}" />
<Rectangle Name="FocusVisual" <Rectangle Name="FocusVisual"
StrokeThickness="1" IsHitTestVisible="False"
IsVisible="False"
Stroke="{DynamicResource HighlightBrush}" Stroke="{DynamicResource HighlightBrush}"
IsHitTestVisible="False"/> StrokeThickness="1" />
</Grid> </Grid>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style>
<Style Selector="CalendarButton /template/ Rectangle#Background">
<Setter Property="IsVisible" Value="False"/>
</Style>
<Style Selector="CalendarButton:pointerover /template/ Rectangle#Background">
<Setter Property="IsVisible" Value="True"/>
</Style>
<Style Selector="CalendarButton:pressed /template/ Rectangle#Background">
<Setter Property="IsVisible" Value="True"/>
</Style>
<Style Selector="CalendarButton /template/ Rectangle#SelectedBackground"> <Style Selector="^:pointerover /template/ Rectangle#Background">
<Setter Property="IsVisible" Value="False"/> <Setter Property="IsVisible" Value="True" />
</Style> </Style>
<Style Selector="CalendarButton:selected /template/ Rectangle#SelectedBackground"> <Style Selector="^:pressed /template/ Rectangle#Background">
<Setter Property="IsVisible" Value="True"/> <Setter Property="IsVisible" Value="True" />
</Style> </Style>
<Style Selector="CalendarButton /template/ ContentControl#Content"> <Style Selector="^:selected /template/ Rectangle#SelectedBackground">
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}"/> <Setter Property="IsVisible" Value="True" />
</Style> </Style>
<Style Selector="CalendarButton:inactive /template/ ContentControl#Content">
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundLowBrush}"/>
</Style>
<Style Selector="^:inactive /template/ ContentControl#Content">
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundLowBrush}" />
</Style>
<Style Selector="CalendarButton /template/ Rectangle#FocusVisual"> <Style Selector="^:btnfocused /template/ Rectangle#FocusVisual">
<Setter Property="IsVisible" Value="False"/> <Setter Property="IsVisible" Value="True" />
</Style> </Style>
<Style Selector="CalendarButton:btnfocused /template/ Rectangle#FocusVisual"> </ControlTheme>
<Setter Property="IsVisible" Value="True"/> </ResourceDictionary>
</Style>
</Styles>

136
src/Avalonia.Themes.Default/Controls/CalendarDatePicker.xaml

@ -1,20 +1,21 @@
<!-- <!--
// (c) Copyright Microsoft Corporation. // (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL). // This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details. // Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved. // All other rights reserved.
--> -->
<Styles xmlns="https://github.com/avaloniaui" <ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=netstandard"> xmlns:sys="using:System"
<Style Selector="CalendarDatePicker"> x:CompileBindings="True">
<ControlTheme x:Key="{x:Type CalendarDatePicker}"
TargetType="CalendarDatePicker">
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" />
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}" />
<Setter Property="Padding" Value="4" />
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/>
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}"/>
<Setter Property="Padding" Value="4"/>
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Grid ColumnDefinitions="*,Auto"> <Grid ColumnDefinitions="*,Auto">
@ -24,110 +25,115 @@
<Style Selector="Button.CalendarDropDown"> <Style Selector="Button.CalendarDropDown">
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Grid Height="18" <Grid Width="19"
Width="19" Height="18"
Margin="0"
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center" VerticalAlignment="Center"
Margin="0"
Background="{DynamicResource ThemeControlLowBrush}" Background="{DynamicResource ThemeControlLowBrush}"
ClipToBounds="False"
ColumnDefinitions="*,*,*,*" ColumnDefinitions="*,*,*,*"
RowDefinitions="23*,19*,19*,19*" RowDefinitions="23*,19*,19*,19*">
ClipToBounds="False">
<Border Name="Highlight" <Border Name="Highlight"
Margin="-1"
Grid.ColumnSpan="4"
Grid.Row="0" Grid.Row="0"
Grid.RowSpan="4" Grid.RowSpan="4"
BorderThickness="1"
BorderBrush="{DynamicResource HighlightBrush}" />
<Border Name="Background"
Margin="0,-1,0,0"
Grid.ColumnSpan="4" Grid.ColumnSpan="4"
Margin="-1"
BorderBrush="{DynamicResource HighlightBrush}"
BorderThickness="1" />
<Border Name="Background"
Grid.Row="1" Grid.Row="1"
Grid.RowSpan="3" Grid.RowSpan="3"
BorderThickness="1" Grid.ColumnSpan="4"
Margin="0,-1,0,0"
BorderBrush="{DynamicResource ThemeBorderHighBrush}" BorderBrush="{DynamicResource ThemeBorderHighBrush}"
BorderThickness="1"
CornerRadius=".5" /> CornerRadius=".5" />
<Rectangle Grid.ColumnSpan="4" <Rectangle Grid.RowSpan="1"
Grid.RowSpan="1" Grid.ColumnSpan="4"
StrokeThickness="1" Fill="{DynamicResource ThemeAccentBrush}"
Stroke="{DynamicResource ThemeBorderHighBrush}" Stroke="{DynamicResource ThemeBorderHighBrush}"
Fill="{DynamicResource ThemeAccentBrush}"> StrokeThickness="1" />
</Rectangle> <TextBlock Grid.Row="1"
<TextBlock Margin="0,-1,0,0" Grid.RowSpan="3"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Grid.Column="0" Grid.Column="0"
Grid.Row="1"
Grid.ColumnSpan="4" Grid.ColumnSpan="4"
Grid.RowSpan="3" Margin="0,-1,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="{DynamicResource FontSizeSmall}" FontSize="{DynamicResource FontSizeSmall}"
Foreground="{DynamicResource ThemeBorderHighBrush}" Foreground="{DynamicResource ThemeBorderHighBrush}"
Text="{Binding Source={x:Static sys:DateTime.Today}, Path=Day}"/> Text="{Binding Source={x:Static sys:DateTime.Today}, Path=Day}" />
<Ellipse HorizontalAlignment="Center" VerticalAlignment="Center" Fill="{DynamicResource ThemeControlLowBrush}" StrokeThickness="0" Grid.ColumnSpan="4" Width="3" Height="3"/> <Ellipse Grid.ColumnSpan="4"
Width="3"
Height="3"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Fill="{DynamicResource ThemeControlLowBrush}"
StrokeThickness="0" />
</Grid> </Grid>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style> </Style>
<Style Selector="Button.CalendarDropDown /template/ Border#Highlight"> <Style Selector="Button.CalendarDropDown /template/ Border#Highlight">
<Setter Property="IsVisible" Value="False"/> <Setter Property="IsVisible" Value="False" />
</Style> </Style>
<Style Selector="Button.CalendarDropDown:pressed /template/ Border#Highlight"> <Style Selector="Button.CalendarDropDown:pressed /template/ Border#Highlight">
<Setter Property="IsVisible" Value="True"/> <Setter Property="IsVisible" Value="True" />
</Style> </Style>
<Style Selector="Button.CalendarDropDown:pointerover /template/ Border#Background"> <Style Selector="Button.CalendarDropDown:pointerover /template/ Border#Background">
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush4}"/> <Setter Property="Background" Value="{DynamicResource ThemeAccentBrush4}" />
</Style> </Style>
</Grid.Styles> </Grid.Styles>
<TextBox Name="PART_TextBox" <TextBox Name="PART_TextBox"
Background="{TemplateBinding Background}" Grid.Column="0"
BorderBrush="{TemplateBinding BorderBrush}" Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}" CornerRadius="{TemplateBinding CornerRadius}"
Padding="{TemplateBinding Padding}"
Watermark="{TemplateBinding Watermark}"
UseFloatingWatermark="{TemplateBinding UseFloatingWatermark}"
DataValidationErrors.Errors="{TemplateBinding (DataValidationErrors.Errors)}" DataValidationErrors.Errors="{TemplateBinding (DataValidationErrors.Errors)}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" UseFloatingWatermark="{TemplateBinding UseFloatingWatermark}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Watermark="{TemplateBinding Watermark}" />
Grid.Column="0"/>
<Button Name="PART_Button" <Button Name="PART_Button"
Grid.Column="1" Grid.Column="1"
Width="20" Width="20"
Classes="CalendarDropDown"
Foreground="{TemplateBinding Foreground}"
Background="Transparent"
BorderThickness="0"
Margin="2,0,2,0" Margin="2,0,2,0"
Padding="0" Padding="0"
Background="Transparent"
BorderThickness="0"
Classes="CalendarDropDown"
ClipToBounds="False" ClipToBounds="False"
Focusable="False"/> Focusable="False"
Foreground="{TemplateBinding Foreground}" />
<Popup Name="PART_Popup" <Popup Name="PART_Popup"
PlacementTarget="{TemplateBinding}" PlacementTarget="{TemplateBinding}"
StaysOpen="False"> StaysOpen="False">
<Calendar Name="PART_Calendar" <Calendar Name="PART_Calendar"
FirstDayOfWeek="{TemplateBinding FirstDayOfWeek}"
IsTodayHighlighted="{TemplateBinding IsTodayHighlighted}"
SelectedDate="{TemplateBinding SelectedDate, Mode=TwoWay}"
DisplayDate="{TemplateBinding DisplayDate}" DisplayDate="{TemplateBinding DisplayDate}"
DisplayDateEnd="{TemplateBinding DisplayDateEnd}"
DisplayDateStart="{TemplateBinding DisplayDateStart}" DisplayDateStart="{TemplateBinding DisplayDateStart}"
DisplayDateEnd="{TemplateBinding DisplayDateEnd}" /> FirstDayOfWeek="{TemplateBinding FirstDayOfWeek}"
IsTodayHighlighted="{TemplateBinding IsTodayHighlighted}"
SelectedDate="{TemplateBinding SelectedDate,
Mode=TwoWay}" />
</Popup> </Popup>
</Grid> </Grid>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style>
<Style Selector="CalendarDatePicker:focus /template/ TextBox#PART_TextBox"> <Style Selector="^:focus /template/ TextBox#PART_TextBox">
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderHighBrush}"/> <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderHighBrush}" />
</Style> </Style>
</ControlTheme>
</Styles> </ResourceDictionary>

149
src/Avalonia.Themes.Default/Controls/CalendarDayButton.xaml

@ -1,116 +1,105 @@
<!-- <!--
// (c) Copyright Microsoft Corporation. // (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL). // This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details. // Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved. // All other rights reserved.
--> -->
<Styles xmlns="https://github.com/avaloniaui"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Style Selector="CalendarDayButton"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ControlTheme x:Key="{x:Type CalendarDayButton}"
TargetType="CalendarDayButton">
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush2}" /> <Setter Property="Background" Value="{DynamicResource ThemeAccentBrush2}" />
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" />
<Setter Property="FontSize" Value="{DynamicResource FontSizeSmall}" /> <Setter Property="FontSize" Value="{DynamicResource FontSizeSmall}" />
<Setter Property="HorizontalContentAlignment" Value="Center" /> <Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" /> <Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="MinWidth" Value="5" /> <Setter Property="MinWidth" Value="5" />
<Setter Property="MinHeight" Value="5" /> <Setter Property="MinHeight" Value="5" />
<Setter Property="Focusable" Value="False"/> <Setter Property="Focusable" Value="False" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Panel Background="Transparent"> <Panel Background="Transparent">
<Rectangle Name="TodayBackground" <Rectangle Name="TodayBackground"
Fill="{DynamicResource HighlightBrush}"/> Fill="{DynamicResource HighlightBrush}"
IsVisible="False" />
<Rectangle Name="SelectedBackground" <Rectangle Name="SelectedBackground"
Opacity="0.75" Fill="{TemplateBinding Background}"
Fill="{TemplateBinding Background}"/> IsVisible="False"
Opacity="0.75" />
<Rectangle Name="Background" <Rectangle Name="Background"
Opacity="0.5" Fill="{TemplateBinding Background}"
Fill="{TemplateBinding Background}"/> IsVisible="False"
Opacity="0.5" />
<ContentControl Name="Content" <ContentControl Name="Content"
ContentTemplate="{TemplateBinding ContentTemplate}" Margin="5,1,5,1"
Content="{TemplateBinding Content}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
FontSize="{TemplateBinding FontSize}" FontSize="{TemplateBinding FontSize}"
Margin="5,1,5,1"/> Foreground="{TemplateBinding Foreground}"
Opacity="1" />
<Path Name="BlackoutVisual" <Path Name="BlackoutVisual"
Margin="3" Margin="3"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
RenderTransformOrigin="0.5,0.5" Data="M8.1772461,11.029181 L10.433105,11.029181 L11.700684,12.801641 L12.973633,11.029181 L15.191895,11.029181 L12.844727,13.999395 L15.21875,17.060919 L12.962891,17.060919 L11.673828,15.256231 L10.352539,17.060919 L8.1396484,17.060919 L10.519043,14.042364 z"
Fill="{DynamicResource ThemeForegroundBrush}" Fill="{DynamicResource ThemeForegroundBrush}"
Stretch="Fill" IsVisible="False"
Data="M8.1772461,11.029181 L10.433105,11.029181 L11.700684,12.801641 L12.973633,11.029181 L15.191895,11.029181 L12.844727,13.999395 L15.21875,17.060919 L12.962891,17.060919 L11.673828,15.256231 L10.352539,17.060919 L8.1396484,17.060919 L10.519043,14.042364 z" /> RenderTransformOrigin="0.5,0.5"
Stretch="Fill" />
<Rectangle Name="FocusVisual" <Rectangle Name="FocusVisual"
StrokeThickness="1" IsHitTestVisible="False"
IsVisible="False"
Stroke="{DynamicResource HighlightBrush}" Stroke="{DynamicResource HighlightBrush}"
IsHitTestVisible="False"/> StrokeThickness="1" />
</Panel> </Panel>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style>
<Style Selector="CalendarDayButton /template/ Rectangle#Background">
<Setter Property="IsVisible" Value="False"/>
</Style>
<Style Selector="CalendarDayButton:pointerover /template/ Rectangle#Background">
<Setter Property="IsVisible" Value="True"/>
</Style>
<Style Selector="CalendarDayButton:pressed /template/ Rectangle#Background">
<Setter Property="IsVisible" Value="True"/>
</Style>
<Style Selector="CalendarDayButton /template/ Rectangle#SelectedBackground">
<Setter Property="IsVisible" Value="False"/>
</Style>
<Style Selector="CalendarDayButton:selected /template/ Rectangle#SelectedBackground">
<Setter Property="IsVisible" Value="True"/>
</Style>
<Style Selector="CalendarDayButton /template/ ContentControl#Content">
<Setter Property="Opacity" Value="1"/>
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}"/>
</Style>
<Style Selector="CalendarDayButton:disabled /template/ Rectangle#Background">
<Setter Property="IsVisible" Value="False"/>
</Style>
<Style Selector="CalendarDayButton:disabled /template/ ContentControl#Content">
<Setter Property="Opacity" Value="0.3"/>
</Style>
<Style Selector="CalendarDayButton /template/ Rectangle#FocusVisual">
<Setter Property="IsVisible" Value="False"/>
</Style>
<Style Selector="CalendarDayButton:dayfocused /template/ Rectangle#FocusVisual">
<Setter Property="IsVisible" Value="True"/>
</Style>
<Style Selector="CalendarDayButton /template/ Rectangle#TodayBackground">
<Setter Property="IsVisible" Value="False"/>
</Style>
<Style Selector="CalendarDayButton:today /template/ Rectangle#TodayBackground">
<Setter Property="IsVisible" Value="True"/>
</Style>
<Style Selector="CalendarDayButton:inactive /template/ ContentControl#Content">
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundLowBrush}"/>
</Style>
<Style Selector="CalendarDayButton:today /template/ ContentControl#Content">
<Setter Property="Foreground" Value="{DynamicResource ThemeControlLowBrush}"/>
</Style>
<Style Selector="CalendarDayButton /template/ Path#BlackoutVisual">
<Setter Property="Opacity" Value="0"/>
</Style>
<Style Selector="CalendarDayButton:blackout /template/ Path#BlackoutVisual">
<Setter Property="Opacity" Value="0.3"/>
</Style>
</Styles> <Style Selector="^:pointerover /template/ Rectangle#Background">
<Setter Property="IsVisible" Value="True" />
</Style>
<Style Selector="^:pressed /template/ Rectangle#Background">
<Setter Property="IsVisible" Value="True" />
</Style>
<Style Selector="^:selected /template/ Rectangle#SelectedBackground">
<Setter Property="IsVisible" Value="True" />
</Style>
<Style Selector="^:disabled /template/ Rectangle#Background">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="^:disabled /template/ ContentControl#Content">
<Setter Property="Opacity" Value="0.3" />
</Style>
<Style Selector="^:dayfocused /template/ Rectangle#FocusVisual">
<Setter Property="IsVisible" Value="True" />
</Style>
<Style Selector="^:today /template/ Rectangle#TodayBackground">
<Setter Property="IsVisible" Value="True" />
</Style>
<Style Selector="^:inactive /template/ ContentControl#Content">
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundLowBrush}" />
</Style>
<Style Selector="^:today /template/ ContentControl#Content">
<Setter Property="Foreground" Value="{DynamicResource ThemeControlLowBrush}" />
</Style>
<Style Selector="^:blackout /template/ Path#BlackoutVisual">
<Setter Property="Opacity" Value="0.3" />
</Style>
</ControlTheme>
</ResourceDictionary>

139
src/Avalonia.Themes.Default/Controls/CalendarItem.xaml

@ -1,26 +1,27 @@
<!-- <!--
// (c) Copyright Microsoft Corporation. // (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL). // This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details. // Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved. // All other rights reserved.
--> -->
<Styles xmlns="https://github.com/avaloniaui" <ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style Selector="CalendarItem"> <ControlTheme x:Key="{x:Type CalendarItem}"
TargetType="CalendarItem">
<Setter Property="CornerRadius" Value="1" /> <Setter Property="CornerRadius" Value="1" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Panel> <Panel>
<Border BorderThickness="{TemplateBinding BorderThickness}" <Border Margin="0,2,0,2"
CornerRadius="{TemplateBinding CornerRadius}"
BorderBrush="{TemplateBinding BorderBrush}"
Background="{TemplateBinding Background}" Background="{TemplateBinding Background}"
Margin="0,2,0,2"> BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<Border CornerRadius="1" <Border BorderBrush="{DynamicResource ThemeBackgroundBrush}"
BorderBrush="{DynamicResource ThemeBackgroundBrush}" BorderThickness="2"
BorderThickness="2"> CornerRadius="1">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
@ -34,81 +35,81 @@
<Grid.Styles> <Grid.Styles>
<Style Selector="Button.CalendarHeader"> <Style Selector="Button.CalendarHeader">
<Setter Property="Cursor" Value="Hand"/> <Setter Property="Cursor" Value="Hand" />
<Setter Property="Background" Value="Transparent"/> <Setter Property="Background" Value="Transparent" />
<Setter Property="BorderThickness" Value="0"/> <Setter Property="BorderThickness" Value="0" />
</Style> </Style>
<Style Selector="Button.CalendarHeader:pressed /template/ ContentPresenter"> <Style Selector="Button.CalendarHeader:pressed /template/ ContentPresenter">
<Setter Property="Background" Value="Transparent"/> <Setter Property="Background" Value="Transparent" />
</Style> </Style>
<Style Selector="Button.CalendarNavigation"> <Style Selector="Button.CalendarNavigation">
<Setter Property="Height" Value="20"/> <Setter Property="Height" Value="20" />
<Setter Property="Width" Value="28"/> <Setter Property="Width" Value="28" />
</Style> </Style>
<Style Selector="Button.CalendarNavigation > Path"> <Style Selector="Button.CalendarNavigation > Path">
<Setter Property="Fill" Value="{DynamicResource ThemeForegroundBrush}"/> <Setter Property="Fill" Value="{DynamicResource ThemeForegroundBrush}" />
</Style> </Style>
<Style Selector="Button.CalendarNavigation:pointerover > Path"> <Style Selector="Button.CalendarNavigation:pointerover > Path">
<Setter Property="Fill" Value="{DynamicResource HighlightBrush}"/> <Setter Property="Fill" Value="{DynamicResource HighlightBrush}" />
</Style> </Style>
<Style Selector="Button#HeaderButton:pointerover"> <Style Selector="Button#HeaderButton:pointerover">
<Setter Property="Foreground" Value="{DynamicResource HighlightBrush}"/> <Setter Property="Foreground" Value="{DynamicResource HighlightBrush}" />
</Style> </Style>
</Grid.Styles> </Grid.Styles>
<Rectangle Grid.ColumnSpan="3" <Rectangle Grid.ColumnSpan="3"
Fill="{TemplateBinding HeaderBackground}" Height="22"
Stretch="Fill"
VerticalAlignment="Top" VerticalAlignment="Top"
Height="22"/> Fill="{TemplateBinding HeaderBackground}"
Stretch="Fill" />
<Button Name="PreviousButton" <Button Name="PreviousButton"
HorizontalAlignment="Left"
Classes="CalendarHeader CalendarNavigation" Classes="CalendarHeader CalendarNavigation"
IsVisible="False" IsVisible="False">
HorizontalAlignment="Left">
<Path Margin="14,-6,0,0" <Path Width="6"
Height="10" Height="10"
Width="6" Margin="14,-6,0,0"
VerticalAlignment="Center"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Stretch="Fill" VerticalAlignment="Center"
Data="M288.75,232.25 L288.75,240.625 L283,236.625 z" /> Data="M288.75,232.25 L288.75,240.625 L283,236.625 z"
Stretch="Fill" />
</Button> </Button>
<Button Name="HeaderButton" <Button Name="HeaderButton"
Classes="CalendarHeader"
Grid.Column="1" Grid.Column="1"
FontWeight="Bold" Padding="1,5,1,9"
FontSize="10.5"
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center" VerticalAlignment="Center"
Padding="1,5,1,9"/> Classes="CalendarHeader"
FontSize="10.5"
FontWeight="Bold" />
<Button Name="NextButton" <Button Name="NextButton"
Classes="CalendarHeader CalendarNavigation"
Grid.Column="2" Grid.Column="2"
IsVisible="False" HorizontalAlignment="Right"
HorizontalAlignment="Right" > Classes="CalendarHeader CalendarNavigation"
IsVisible="False">
<Path Margin="0,-6,14,0" <Path Width="6"
Height="10" Height="10"
Width="6" Margin="0,-6,14,0"
Stretch="Fill"
VerticalAlignment="Center"
HorizontalAlignment="Right" HorizontalAlignment="Right"
Data="M282.875,231.875 L282.875,240.375 L288.625,236 z" /> VerticalAlignment="Center"
Data="M282.875,231.875 L282.875,240.375 L288.625,236 z"
Stretch="Fill" />
</Button> </Button>
<Grid Name="MonthView" <Grid Name="MonthView"
Grid.Row="1" Grid.Row="1"
Grid.ColumnSpan="3" Grid.ColumnSpan="3"
IsVisible="False" Margin="6,-1,6,6"
Margin="6,-1,6,6"> IsVisible="False">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
@ -132,8 +133,8 @@
<Grid Name="YearView" <Grid Name="YearView"
Grid.Row="1" Grid.Row="1"
Grid.ColumnSpan="3" Grid.ColumnSpan="3"
IsVisible="False" Margin="6,-3,7,6"
Margin="6,-3,7,6"> IsVisible="False">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
@ -146,39 +147,33 @@
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
</Grid> </Grid>
</Grid> </Grid>
</Border> </Border>
</Border> </Border>
<Rectangle Name="DisabledVisual" <Rectangle Name="DisabledVisual"
Stretch="Fill" Margin="0,2,0,2"
Fill="{DynamicResource ThemeControlLowBrush}" Fill="{DynamicResource ThemeControlLowBrush}"
IsVisible="False"
Opacity="{DynamicResource ThemeDisabledOpacity}" Opacity="{DynamicResource ThemeDisabledOpacity}"
Margin="0,2,0,2" /> Stretch="Fill" />
</Panel> </Panel>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
<Setter Property="DayTitleTemplate"> <Setter Property="DayTitleTemplate">
<Template> <Template>
<TextBlock FontWeight="Bold" <TextBlock Margin="0,4,0,4"
FontSize="9.5"
Margin="0,4,0,4"
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center" VerticalAlignment="Center"
FontSize="9.5"
FontWeight="Bold"
Text="{Binding}" /> Text="{Binding}" />
</Template> </Template>
</Setter> </Setter>
</Style>
<Style Selector="^:calendardisabled /template/ Rectangle#DisabledVisual">
<Style Selector="CalendarItem /template/ Rectangle#DisabledVisual"> <Setter Property="IsVisible" Value="True" />
<Setter Property="IsVisible" Value="False"/> </Style>
</Style> </ControlTheme>
<Style Selector="CalendarItem:calendardisabled /template/ Rectangle#DisabledVisual"> </ResourceDictionary>
<Setter Property="IsVisible" Value="True"/>
</Style>
</Styles>

153
src/Avalonia.Themes.Default/Controls/CaptionButtons.xaml

@ -1,73 +1,106 @@
<Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Style Selector="CaptionButtons"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}"/> <Design.PreviewWith>
<Border Padding="20">
<StackPanel Spacing="20">
<CaptionButtons Height="30" />
</StackPanel>
</Border>
</Design.PreviewWith>
<ControlTheme x:Key="DefaultCaptionButton"
TargetType="Button">
<Setter Property="Background" Value="#ffe5e5e5" />
<!-- Reusing BorderBrush to define pressed background color, as it's not used otherwise -->
<Setter Property="BorderBrush" Value="#ffcacaca" />
<Setter Property="Foreground" Value="Black" />
<Setter Property="Width" Value="45" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="Template">
<ControlTemplate>
<ContentPresenter Name="PART_ContentPresenter"
Background="Transparent"
Content="{TemplateBinding Content}" />
</ControlTemplate>
</Setter>
<Style Selector="^:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="{TemplateBinding Background}" />
</Style>
<Style Selector="^:pressed /template/ ContentPresenter">
<Setter Property="Background" Value="{TemplateBinding BorderBrush}" />
</Style>
</ControlTheme>
<ControlTheme x:Key="{x:Type CaptionButtons}"
TargetType="CaptionButtons">
<Setter Property="MaxHeight" Value="30" /> <Setter Property="MaxHeight" Value="30" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<StackPanel Spacing="2" VerticalAlignment="Stretch" TextElement.FontSize="10" Orientation="Horizontal"> <StackPanel VerticalAlignment="Stretch"
<StackPanel.Styles> Orientation="Horizontal"
<Style Selector="Panel"> Spacing="2"
<Setter Property="Width" Value="45" /> TextElement.FontSize="10">
<Setter Property="Background" Value="Transparent" /> <Button x:Name="PART_FullScreenButton"
</Style> IsVisible="False"
<Style Selector="Panel:pointerover"> Theme="{StaticResource DefaultCaptionButton}">
<Setter Property="Background" Value="#7F7f7f7f" /> <Viewbox Width="11"
</Style> Margin="2">
<Style Selector="Panel#PART_CloseButton:pointerover"> <Path Name="FullScreenButtonPath"
<Setter Property="Background" Value="#7FFF0000" /> Data="M2048 2048v-819h-205v469l-1493 -1493h469v-205h-819v819h205v-469l1493 1493h-469v205h819z"
</Style> Fill="{TemplateBinding Foreground}"
<Style Selector="Viewbox"> Stretch="UniformToFill" />
<Setter Property="Width" Value="11" />
<Setter Property="Margin" Value="2" />
</Style>
</StackPanel.Styles>
<Panel x:Name="PART_FullScreenButton">
<Viewbox>
<Path Stretch="UniformToFill" Fill="{TemplateBinding Foreground}" />
</Viewbox> </Viewbox>
</Panel> </Button>
<Button x:Name="PART_MinimiseButton"
<Panel x:Name="PART_MinimiseButton"> Theme="{StaticResource DefaultCaptionButton}">
<Viewbox> <Viewbox Width="11"
<Path Stretch="UniformToFill" Fill="{TemplateBinding Foreground}" Data="M2048 1229v-205h-2048v205h2048z" /> Margin="2">
<Path Data="M2048 1229v-205h-2048v205h2048z"
Fill="{TemplateBinding Foreground}"
Stretch="UniformToFill" />
</Viewbox> </Viewbox>
</Panel> </Button>
<Button x:Name="PART_RestoreButton"
<Panel x:Name="PART_RestoreButton"> Theme="{StaticResource DefaultCaptionButton}">
<Viewbox> <Viewbox Width="11"
Margin="2">
<Viewbox.RenderTransform> <Viewbox.RenderTransform>
<RotateTransform Angle="-90" /> <RotateTransform Angle="-90" />
</Viewbox.RenderTransform> </Viewbox.RenderTransform>
<Path Stretch="UniformToFill" Fill="{TemplateBinding Foreground}"/> <Path Name="RestoreButtonPath"
Data="M2048 2048v-2048h-2048v2048h2048zM1843 1843h-1638v-1638h1638v1638z"
Fill="{TemplateBinding Foreground}"
Stretch="UniformToFill" />
</Viewbox> </Viewbox>
</Panel> </Button>
<Button x:Name="PART_CloseButton"
<Panel x:Name="PART_CloseButton"> Background="#ffe81123"
<Viewbox> BorderBrush="#fff1707a"
<Path Stretch="UniformToFill" Fill="{TemplateBinding Foreground}" Data="M1169 1024l879 -879l-145 -145l-879 879l-879 -879l-145 145l879 879l-879 879l145 145l879 -879l879 879l145 -145z" /> Theme="{StaticResource DefaultCaptionButton}">
<Viewbox Width="11"
Margin="2">
<Path Data="M1169 1024l879 -879l-145 -145l-879 879l-879 -879l-145 145l879 879l-879 879l145 145l879 -879l879 879l145 -145z"
Fill="{TemplateBinding Foreground}"
Stretch="UniformToFill" />
</Viewbox> </Viewbox>
</Panel> </Button>
</StackPanel> </StackPanel>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style> <Style Selector="^:maximized /template/ Path#RestoreButtonPath">
<Style Selector="CaptionButtons Panel#PART_RestoreButton Path"> <Setter Property="Data" Value="M2048 410h-410v-410h-1638v1638h410v410h1638v-1638zM1434 1434h-1229v-1229h1229v1229zM1843 1843h-1229v-205h1024v-1024h205v1229z" />
<Setter Property="Data" Value="M2048 2048v-2048h-2048v2048h2048zM1843 1843h-1638v-1638h1638v1638z" /> </Style>
</Style> <Style Selector="^:fullscreen /template/ Path#PART_FullScreenButtonPath">
<Style Selector="CaptionButtons:maximized Panel#PART_RestoreButton Path"> <Setter Property="IsVisible" Value="True" />
<Setter Property="Data" Value="M2048 410h-410v-410h-1638v1638h410v410h1638v-1638zM1434 1434h-1229v-1229h1229v1229zM1843 1843h-1229v-205h1024v-1024h205v1229z" /> <Setter Property="Data" Value="M205 1024h819v-819h-205v469l-674 -674l-145 145l674 674h-469v205zM1374 1229h469v-205h-819v819h205v-469l674 674l145 -145z" />
</Style> </Style>
<Style Selector="CaptionButtons Panel#PART_FullScreenButton"> <Style Selector="^:fullscreen /template/ Panel#PART_RestoreButton">
<Setter Property="IsVisible" Value="False" /> <Setter Property="IsVisible" Value="False" />
</Style> </Style>
<Style Selector="CaptionButtons Panel#PART_FullScreenButton Path"> <Style Selector="^:fullscreen /template/ Panel#PART_MinimiseButton">
<Setter Property="Data" Value="M2048 2048v-819h-205v469l-1493 -1493h469v-205h-819v819h205v-469l1493 1493h-469v205h819z" /> <Setter Property="IsVisible" Value="False" />
</Style> </Style>
<Style Selector="CaptionButtons:fullscreen Panel#PART_FullScreenButton Path"> </ControlTheme>
<Setter Property="IsVisible" Value="True" /> </ResourceDictionary>
<Setter Property="Data" Value="M205 1024h819v-819h-205v469l-674 -674l-145 145l674 674h-469v205zM1374 1229h469v-205h-819v819h205v-469l674 674l145 -145z" />
</Style>
<Style Selector="CaptionButtons:fullscreen Panel#PART_RestoreButton, CaptionButtons:fullscreen Panel#PART_MinimiseButton">
<Setter Property="IsVisible" Value="False" />
</Style>
</Styles>

38
src/Avalonia.Themes.Default/Controls/Carousel.xaml

@ -1,17 +1,21 @@
<Style xmlns="https://github.com/avaloniaui" Selector="Carousel"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Setter Property="Template"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ControlTemplate> <ControlTheme x:Key="{x:Type Carousel}"
<Border Background="{TemplateBinding Background}" TargetType="Carousel">
BorderBrush="{TemplateBinding BorderBrush}" <Setter Property="Template">
BorderThickness="{TemplateBinding BorderThickness}" <ControlTemplate>
CornerRadius="{TemplateBinding CornerRadius}"> <Border Background="{TemplateBinding Background}"
<CarouselPresenter IsVirtualized="{TemplateBinding IsVirtualized}" BorderBrush="{TemplateBinding BorderBrush}"
Items="{TemplateBinding Items}" BorderThickness="{TemplateBinding BorderThickness}"
ItemsPanel="{TemplateBinding ItemsPanel}" CornerRadius="{TemplateBinding CornerRadius}">
Margin="{TemplateBinding Padding}" <CarouselPresenter Margin="{TemplateBinding Padding}"
SelectedIndex="{TemplateBinding SelectedIndex}" IsVirtualized="{TemplateBinding IsVirtualized}"
PageTransition="{TemplateBinding PageTransition}"/> Items="{TemplateBinding Items}"
</Border> ItemsPanel="{TemplateBinding ItemsPanel}"
</ControlTemplate> PageTransition="{TemplateBinding PageTransition}"
</Setter> SelectedIndex="{TemplateBinding SelectedIndex}" />
</Style> </Border>
</ControlTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>

95
src/Avalonia.Themes.Default/Controls/CheckBox.xaml

@ -1,72 +1,75 @@
<Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Style Selector="CheckBox"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}"/> <ControlTheme x:Key="{x:Type CheckBox}"
<Setter Property="Background" Value="Transparent"/> TargetType="CheckBox">
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/> <Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" />
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}"/> <Setter Property="Background" Value="Transparent" />
<Setter Property="Padding" Value="4,0,0,0"/> <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" />
<Setter Property="VerticalContentAlignment" Value="Center"/> <Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}" />
<Setter Property="HorizontalContentAlignment" Value="Left"/> <Setter Property="Padding" Value="4,0,0,0" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Grid ColumnDefinitions="Auto,*"> <Grid ColumnDefinitions="Auto,*">
<Border Name="border" <Border Name="border"
Width="18"
Height="18"
VerticalAlignment="Center"
Background="{TemplateBinding Background}" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}" CornerRadius="{TemplateBinding CornerRadius}">
Width="18"
Height="18"
VerticalAlignment="Center">
<Panel> <Panel>
<Path Name="checkMark" <Path Name="checkMark"
Fill="{DynamicResource HighlightBrush}"
Width="11" Width="11"
Height="10" Height="10"
Stretch="Uniform"
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center" VerticalAlignment="Center"
Data="M 1145.607177734375,430 C1145.607177734375,430 1141.449951171875,435.0772705078125 1141.449951171875,435.0772705078125 1141.449951171875,435.0772705078125 1139.232177734375,433.0999755859375 1139.232177734375,433.0999755859375 1139.232177734375,433.0999755859375 1138,434.5538330078125 1138,434.5538330078125 1138,434.5538330078125 1141.482177734375,438 1141.482177734375,438 1141.482177734375,438 1141.96875,437.9375 1141.96875,437.9375 1141.96875,437.9375 1147,431.34619140625 1147,431.34619140625 1147,431.34619140625 1145.607177734375,430 1145.607177734375,430 z"
Fill="{DynamicResource HighlightBrush}"
FlowDirection="LeftToRight" FlowDirection="LeftToRight"
Data="M 1145.607177734375,430 C1145.607177734375,430 1141.449951171875,435.0772705078125 1141.449951171875,435.0772705078125 1141.449951171875,435.0772705078125 1139.232177734375,433.0999755859375 1139.232177734375,433.0999755859375 1139.232177734375,433.0999755859375 1138,434.5538330078125 1138,434.5538330078125 1138,434.5538330078125 1141.482177734375,438 1141.482177734375,438 1141.482177734375,438 1141.96875,437.9375 1141.96875,437.9375 1141.96875,437.9375 1147,431.34619140625 1147,431.34619140625 1147,431.34619140625 1145.607177734375,430 1145.607177734375,430 z"/> Stretch="Uniform" />
<Rectangle Name="indeterminateMark" <Rectangle Name="indeterminateMark"
Fill="{DynamicResource HighlightBrush}"
Width="10" Width="10"
Height="10" Height="10"
Stretch="Uniform"
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center"/> VerticalAlignment="Center"
Fill="{DynamicResource HighlightBrush}"
Stretch="Uniform" />
</Panel> </Panel>
</Border> </Border>
<ContentPresenter Name="PART_ContentPresenter" <ContentPresenter Name="PART_ContentPresenter"
TextElement.Foreground="{TemplateBinding Foreground}" Grid.Column="1"
ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding Content}"
Margin="{TemplateBinding Padding}" Margin="{TemplateBinding Padding}"
RecognizesAccessKey="True"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
IsVisible="{TemplateBinding Content, Converter={x:Static ObjectConverters.IsNotNull}}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Grid.Column="1"/> Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
IsVisible="{TemplateBinding Content,
Converter={x:Static ObjectConverters.IsNotNull}}"
RecognizesAccessKey="True"
TextElement.Foreground="{TemplateBinding Foreground}" />
</Grid> </Grid>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style> <Style Selector="^:pointerover /template/ Border#border">
<Style Selector="CheckBox:pointerover /template/ Border#border"> <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderHighBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderHighBrush}"/> </Style>
</Style> <Style Selector="^ /template/ Path#checkMark">
<Style Selector="CheckBox /template/ Path#checkMark"> <Setter Property="IsVisible" Value="False" />
<Setter Property="IsVisible" Value="False"/> </Style>
</Style> <Style Selector="^ /template/ Rectangle#indeterminateMark">
<Style Selector="CheckBox /template/ Rectangle#indeterminateMark"> <Setter Property="IsVisible" Value="False" />
<Setter Property="IsVisible" Value="False"/> </Style>
</Style> <Style Selector="^:checked /template/ Path#checkMark">
<Style Selector="CheckBox:checked /template/ Path#checkMark"> <Setter Property="IsVisible" Value="True" />
<Setter Property="IsVisible" Value="True"/> </Style>
</Style> <Style Selector="^:indeterminate /template/ Rectangle#indeterminateMark">
<Style Selector="CheckBox:indeterminate /template/ Rectangle#indeterminateMark"> <Setter Property="IsVisible" Value="True" />
<Setter Property="IsVisible" Value="True"/> </Style>
</Style> <Style Selector="^:disabled /template/ Border#border">
<Style Selector="CheckBox:disabled /template/ Border#border"> <Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}"/> </Style>
</Style> </ControlTheme>
</Styles> </ResourceDictionary>

81
src/Avalonia.Themes.Default/Controls/ComboBox.xaml

@ -1,23 +1,7 @@
<Styles xmlns="https://github.com/avaloniaui" <ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Design.PreviewWith> <ControlTheme x:Key="{x:Type ComboBox}"
<Border Padding="20"> TargetType="ComboBox">
<StackPanel Spacing="10">
<ComboBox PlaceholderText="Select an item">
<ComboBoxItem>Item 1</ComboBoxItem>
<ComboBoxItem>Item 2</ComboBoxItem>
</ComboBox>
<ComboBox IsEnabled="False"
Width="200"
SelectedIndex="1"
HorizontalContentAlignment="Center">
<ComboBoxItem>Item 1</ComboBoxItem>
<ComboBoxItem>Item 2</ComboBoxItem>
</ComboBox>
</StackPanel>
</Border>
</Design.PreviewWith>
<Style Selector="ComboBox">
<Setter Property="Background" Value="Transparent" /> <Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" /> <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" />
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}" /> <Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}" />
@ -37,47 +21,50 @@
<Grid ColumnDefinitions="*,Auto"> <Grid ColumnDefinitions="*,Auto">
<TextBlock Name="PlaceholderTextBlock" <TextBlock Name="PlaceholderTextBlock"
Grid.Column="0" Grid.Column="0"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Margin="{TemplateBinding Padding}"
Text="{TemplateBinding PlaceholderText}"
Foreground="{TemplateBinding PlaceholderForeground}" Foreground="{TemplateBinding PlaceholderForeground}"
IsVisible="{TemplateBinding SelectionBoxItem, Converter={x:Static ObjectConverters.IsNull}}" /> IsVisible="{TemplateBinding SelectionBoxItem,
<ContentControl Content="{TemplateBinding SelectionBoxItem}" Converter={x:Static ObjectConverters.IsNull}}"
ContentTemplate="{TemplateBinding ItemTemplate}" Text="{TemplateBinding PlaceholderText}" />
Margin="{TemplateBinding Padding}" <ContentControl Margin="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" /> Content="{TemplateBinding SelectionBoxItem}"
ContentTemplate="{TemplateBinding ItemTemplate}" />
<ToggleButton Name="toggle" <ToggleButton Name="toggle"
BorderThickness="0" Grid.Column="1"
Background="Transparent" Background="Transparent"
BorderThickness="0"
ClickMode="Press" ClickMode="Press"
Focusable="False" Focusable="False"
IsChecked="{TemplateBinding IsDropDownOpen, Mode=TwoWay}" IsChecked="{TemplateBinding IsDropDownOpen,
Grid.Column="1"> Mode=TwoWay}">
<Path Fill="{DynamicResource ThemeForegroundBrush}" <Path Width="8"
Width="8"
Height="4" Height="4"
Stretch="Uniform"
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center" VerticalAlignment="Center"
Data="F1 M 301.14,-189.041L 311.57,-189.041L 306.355,-182.942L 301.14,-189.041 Z" /> Data="F1 M 301.14,-189.041L 311.57,-189.041L 306.355,-182.942L 301.14,-189.041 Z"
Fill="{DynamicResource ThemeForegroundBrush}"
Stretch="Uniform" />
</ToggleButton> </ToggleButton>
<Popup Name="PART_Popup" <Popup Name="PART_Popup"
IsOpen="{TemplateBinding IsDropDownOpen, Mode=TwoWay}"
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}" MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
MaxHeight="{TemplateBinding MaxDropDownHeight}" MaxHeight="{TemplateBinding MaxDropDownHeight}"
PlacementTarget="{TemplateBinding}" IsLightDismissEnabled="True"
IsLightDismissEnabled="True"> IsOpen="{TemplateBinding IsDropDownOpen,
Mode=TwoWay}"
PlacementTarget="{TemplateBinding}">
<Border Background="{DynamicResource ThemeBackgroundBrush}" <Border Background="{DynamicResource ThemeBackgroundBrush}"
BorderBrush="{DynamicResource ThemeBorderMidBrush}" BorderBrush="{DynamicResource ThemeBorderMidBrush}"
BorderThickness="1"> BorderThickness="1">
<ScrollViewer HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" <ScrollViewer HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"> VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}">
<ItemsPresenter Name="PART_ItemsPresenter" <ItemsPresenter Name="PART_ItemsPresenter"
ItemTemplate="{TemplateBinding ItemTemplate}"
Items="{TemplateBinding Items}" Items="{TemplateBinding Items}"
ItemsPanel="{TemplateBinding ItemsPanel}" ItemsPanel="{TemplateBinding ItemsPanel}"
ItemTemplate="{TemplateBinding ItemTemplate}"
VirtualizationMode="{TemplateBinding VirtualizationMode}" /> VirtualizationMode="{TemplateBinding VirtualizationMode}" />
</ScrollViewer> </ScrollViewer>
</Border> </Border>
@ -86,11 +73,11 @@
</Border> </Border>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style> <Style Selector="^:pointerover /template/ Border#border">
<Style Selector="ComboBox:pointerover /template/ Border#border"> <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderHighBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderHighBrush}" /> </Style>
</Style> <Style Selector="^:disabled /template/ Border#border">
<Style Selector="ComboBox:disabled /template/ Border#border"> <Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" /> </Style>
</Style> </ControlTheme>
</Styles> </ResourceDictionary>

63
src/Avalonia.Themes.Default/Controls/ComboBoxItem.xaml

@ -1,42 +1,39 @@
<Styles xmlns="https://github.com/avaloniaui"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Style Selector="ComboBoxItem"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Setter Property="Background" Value="Transparent"/> <ControlTheme x:Key="{x:Type ComboBoxItem}"
<Setter Property="Padding" Value="2"/> TargetType="ComboBoxItem">
<Setter Property="HorizontalAlignment" Value="Stretch"/> <Setter Property="Background" Value="Transparent" />
<Setter Property="HorizontalContentAlignment" Value="Left"/> <Setter Property="Padding" Value="2" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<ContentPresenter Name="PART_ContentPresenter" <ContentPresenter Name="PART_ContentPresenter"
Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Background="{TemplateBinding Background}" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding Content}" Content="{TemplateBinding Content}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" ContentTemplate="{TemplateBinding ContentTemplate}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" CornerRadius="{TemplateBinding CornerRadius}" />
Padding="{TemplateBinding Padding}"/>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style> <Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ThemeControlHighlightMidBrush}" />
<Style Selector="ComboBoxItem:pointerover /template/ ContentPresenter"> </Style>
<Setter Property="Background" Value="{DynamicResource ThemeControlHighlightMidBrush}"/> <Style Selector="^:selected /template/ ContentPresenter#PART_ContentPresenter">
</Style> <Setter Property="Background" Value="{DynamicResource ThemeAccentBrush4}" />
</Style>
<Style Selector="ComboBoxItem:selected /template/ ContentPresenter"> <Style Selector="^:selected:focus /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush4}"/> <Setter Property="Background" Value="{DynamicResource ThemeAccentBrush3}" />
</Style> </Style>
<Style Selector="^:selected:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Style Selector="ComboBoxItem:selected:focus /template/ ContentPresenter"> <Setter Property="Background" Value="{DynamicResource ThemeAccentBrush3}" />
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush3}"/> </Style>
</Style> <Style Selector="^:selected:focus:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush2}" />
<Style Selector="ComboBoxItem:selected:pointerover /template/ ContentPresenter"> </Style>
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush3}"/> </ControlTheme>
</Style> </ResourceDictionary>
<Style Selector="ComboBoxItem:selected:focus:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush2}"/>
</Style>
</Styles>

36
src/Avalonia.Themes.Default/Controls/ContentControl.xaml

@ -1,16 +1,20 @@
<Style xmlns="https://github.com/avaloniaui" Selector="ContentControl"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Setter Property="Template"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ControlTemplate> <ControlTheme x:Key="{x:Type ContentControl}"
<ContentPresenter Name="PART_ContentPresenter" TargetType="ContentControl">
Background="{TemplateBinding Background}" <Setter Property="Template">
BorderBrush="{TemplateBinding BorderBrush}" <ControlTemplate>
BorderThickness="{TemplateBinding BorderThickness}" <ContentPresenter Name="PART_ContentPresenter"
CornerRadius="{TemplateBinding CornerRadius}" Padding="{TemplateBinding Padding}"
ContentTemplate="{TemplateBinding ContentTemplate}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
Content="{TemplateBinding Content}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" BorderBrush="{TemplateBinding BorderBrush}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"/> BorderThickness="{TemplateBinding BorderThickness}"
</ControlTemplate> Content="{TemplateBinding Content}"
</Setter> ContentTemplate="{TemplateBinding ContentTemplate}"
</Style> CornerRadius="{TemplateBinding CornerRadius}" />
</ControlTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>

46
src/Avalonia.Themes.Default/Controls/ContextMenu.xaml

@ -1,25 +1,29 @@
<Style xmlns="https://github.com/avaloniaui" Selector="ContextMenu"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}"/> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/> <ControlTheme x:Key="{x:Type ContextMenu}"
<Setter Property="BorderThickness" Value="1"/> TargetType="ContextMenu">
<Setter Property="Padding" Value="4,2"/> <Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Padding" Value="4,2" />
<Setter Property="TextBlock.FontSize" Value="{DynamicResource FontSizeNormal}" /> <Setter Property="TextBlock.FontSize" Value="{DynamicResource FontSizeNormal}" />
<Setter Property="TextBlock.FontWeight" Value="Normal" /> <Setter Property="TextBlock.FontWeight" Value="Normal" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Border Background="{TemplateBinding Background}" <Border Padding="{TemplateBinding Padding}"
BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}"
BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}"
CornerRadius="{TemplateBinding CornerRadius}" BorderThickness="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}"> CornerRadius="{TemplateBinding CornerRadius}">
<ScrollViewer Classes="menuscroller"> <ScrollViewer Theme="{StaticResource DefaultMenuScrollViewer}">
<ItemsPresenter Name="PART_ItemsPresenter" <ItemsPresenter Name="PART_ItemsPresenter"
Items="{TemplateBinding Items}" ItemTemplate="{TemplateBinding ItemTemplate}"
ItemsPanel="{TemplateBinding ItemsPanel}" Items="{TemplateBinding Items}"
ItemTemplate="{TemplateBinding ItemTemplate}" ItemsPanel="{TemplateBinding ItemsPanel}"
KeyboardNavigation.TabNavigation="Continue"/> KeyboardNavigation.TabNavigation="Continue" />
</ScrollViewer> </ScrollViewer>
</Border> </Border>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style> </ControlTheme>
</ResourceDictionary>

91
src/Avalonia.Themes.Default/Controls/DataValidationErrors.xaml

@ -1,43 +1,48 @@
<Style xmlns="https://github.com/avaloniaui" <ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
Selector="DataValidationErrors" <ControlTheme x:Key="{x:Type DataValidationErrors}"
x:CompileBindings="True" TargetType="DataValidationErrors">
x:DataType="DataValidationErrors"> <Setter Property="Template">
<Setter Property="Template"> <ControlTemplate>
<ControlTemplate> <DockPanel LastChildFill="True">
<DockPanel LastChildFill="True"> <ContentControl x:DataType="DataValidationErrors"
<ContentControl x:DataType="DataValidationErrors" Content="{Binding (DataValidationErrors.Errors)}"
DockPanel.Dock="Right" ContentTemplate="{TemplateBinding ErrorTemplate}"
ContentTemplate="{TemplateBinding ErrorTemplate}" DataContext="{TemplateBinding Owner}"
DataContext="{TemplateBinding Owner}" DockPanel.Dock="Right"
Content="{Binding (DataValidationErrors.Errors)}" IsVisible="{Binding (DataValidationErrors.HasErrors)}" />
IsVisible="{Binding (DataValidationErrors.HasErrors)}"/> <ContentPresenter Name="PART_ContentPresenter"
<ContentPresenter Name="PART_ContentPresenter" Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}" Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding Content}" CornerRadius="{TemplateBinding CornerRadius}" />
Padding="{TemplateBinding Padding}"/> </DockPanel>
</DockPanel> </ControlTemplate>
</ControlTemplate> </Setter>
</Setter> <Setter Property="ErrorTemplate">
<Setter Property="ErrorTemplate"> <DataTemplate>
<DataTemplate> <Canvas Width="14"
<Canvas Width="14" Height="14" Margin="4 0 1 0" Height="14"
Background="Transparent"> Margin="4,0,1,0"
<Canvas.Styles> Background="Transparent">
<Style Selector="ToolTip"> <Canvas.Styles>
<Setter Property="Background" Value="{DynamicResource ErrorLowBrush}"/> <Style Selector="ToolTip">
<Setter Property="BorderBrush" Value="{DynamicResource ErrorBrush}"/> <Setter Property="Background" Value="{DynamicResource ErrorLowBrush}" />
</Style> <Setter Property="BorderBrush" Value="{DynamicResource ErrorBrush}" />
</Canvas.Styles> </Style>
<ToolTip.Tip> </Canvas.Styles>
<ItemsControl x:DataType="DataValidationErrors" Items="{Binding}"/> <ToolTip.Tip>
</ToolTip.Tip> <ItemsControl x:DataType="DataValidationErrors"
<Path Data="M14,7 A7,7 0 0,0 0,7 M0,7 A7,7 0 1,0 14,7 M7,3l0,5 M7,9l0,2" Stroke="{DynamicResource ErrorBrush}" StrokeThickness="2"/> Items="{Binding}" />
</Canvas> </ToolTip.Tip>
</DataTemplate> <Path Data="M14,7 A7,7 0 0,0 0,7 M0,7 A7,7 0 1,0 14,7 M7,3l0,5 M7,9l0,2"
</Setter> Stroke="{DynamicResource ErrorBrush}"
</Style> StrokeThickness="2" />
</Canvas>
</DataTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>

496
src/Avalonia.Themes.Default/Controls/DatePicker.xaml

@ -1,239 +1,186 @@
<!-- <!--
// (c) Copyright Microsoft Corporation. // (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL). // This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details. // Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved. // All other rights reserved.
--> -->
<Styles xmlns="https://github.com/avaloniaui" <ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=netstandard"> xmlns:sys="clr-namespace:System;assembly=netstandard"
<Styles.Resources> x:CompileBindings="True">
<Thickness x:Key="DatePickerTopHeaderMargin">0,0,0,4</Thickness> <Design.PreviewWith>
<x:Double x:Key="DatePickerFlyoutPresenterHighlightHeight">40</x:Double> <Border Height="500"
<x:Double x:Key="DatePickerFlyoutPresenterItemHeight">40</x:Double> Padding="20">
<x:Double x:Key="DatePickerFlyoutPresenterAcceptDismissHostGridHeight">41</x:Double> <StackPanel VerticalAlignment="Center"
<x:Double x:Key="DatePickerThemeMinWidth">296</x:Double> Spacing="20">
<x:Double x:Key="DatePickerThemeMaxWidth">456</x:Double> <DatePicker />
<Thickness x:Key="DatePickerFlyoutPresenterItemPadding">0,3,0,6</Thickness> <DatePicker CornerRadius="10" />
<Thickness x:Key="DatePickerFlyoutPresenterMonthPadding">9,3,0,6</Thickness> <DatePicker IsEnabled="False" />
<Thickness x:Key="DatePickerHostPadding">0,3,0,6</Thickness> <DatePicker>
<Thickness x:Key="DatePickerHostMonthPadding">9,3,0,6</Thickness> <DataValidationErrors.Error>
<x:Double x:Key="DatePickerSpacerThemeWidth">1</x:Double> <sys:Exception>
</Styles.Resources> <x:Arguments>
<x:String>Error</x:String>
</x:Arguments>
</sys:Exception>
</DataValidationErrors.Error>
</DatePicker>
</StackPanel>
</Border>
</Design.PreviewWith>
<!-- Styles for the items displayed in the selectors --> <Thickness x:Key="DatePickerTopHeaderMargin">0,0,0,4</Thickness>
<Style Selector="ListBoxItem.DateTimePickerItem"> <x:Double x:Key="DatePickerFlyoutPresenterHighlightHeight">40</x:Double>
<Setter Property="Padding" Value="{DynamicResource DatePickerFlyoutPresenterItemPadding}"/> <x:Double x:Key="DatePickerFlyoutPresenterItemHeight">40</x:Double>
<Setter Property="VerticalContentAlignment" Value="Center" /> <x:Double x:Key="DatePickerFlyoutPresenterAcceptDismissHostGridHeight">41</x:Double>
<Setter Property="HorizontalContentAlignment" Value="Center" /> <x:Double x:Key="DatePickerThemeMinWidth">296</x:Double>
</Style> <x:Double x:Key="DatePickerThemeMaxWidth">456</x:Double>
<Style Selector="ListBoxItem.DateTimePickerItem:selected"> <Thickness x:Key="DatePickerFlyoutPresenterItemPadding">0,3,0,6</Thickness>
<Setter Property="IsHitTestVisible" Value="False"/> <Thickness x:Key="DatePickerFlyoutPresenterMonthPadding">9,3,0,6</Thickness>
</Style> <Thickness x:Key="DatePickerHostPadding">0,3,0,6</Thickness>
<Style Selector="ListBoxItem.DateTimePickerItem:selected /template/ Rectangle#PressedBackground"> <Thickness x:Key="DatePickerHostMonthPadding">9,3,0,6</Thickness>
<Setter Property="Fill" Value="Transparent"/> <x:Double x:Key="DatePickerSpacerThemeWidth">1</x:Double>
</Style>
<Style Selector="ListBoxItem.DateTimePickerItem:selected /template/ ContentPresenter">
<Setter Property="Background" Value="Transparent" />
<Setter Property="TextElement.Foreground" Value="{DynamicResource ThemeForegroundBrush}"/>
</Style>
<Style Selector="ListBoxItem.DateTimePickerItem.MonthItem">
<Setter Property="Padding" Value="{DynamicResource DatePickerFlyoutPresenterMonthPadding}"/>
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
</Style>
<ControlTheme x:Key="DefaultDatePickerFlyoutButton"
<!-- This is used for both the accept/dismiss & repeatbuttons in the presenter--> TargetType="Button">
<Style Selector=":is(Button).DateTimeFlyoutButtonStyle"> <Setter Property="RenderTransform" Value="none" />
<Setter Property="Background" Value="{DynamicResource ThemeControlTransparentBrush}" />
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Border Background="{TemplateBinding Background}"> <ContentPresenter Name="PART_ContentPresenter"
<ContentPresenter x:Name="ContentPresenter" HorizontalContentAlignment="Stretch"
Background="{TemplateBinding Background}" VerticalContentAlignment="Stretch"
BorderBrush="{DynamicResource ThemeControlTransparentBrush}" Background="{TemplateBinding Background}"
BorderThickness="{DynamicResource DateTimeFlyoutButtonBorderThickness}" BorderBrush="{TemplateBinding BorderBrush}"
Content="{TemplateBinding Content}" BorderThickness="{TemplateBinding BorderThickness}"
TextElement.Foreground="{DynamicResource ThemeForegroundBrush}" Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}" CornerRadius="{TemplateBinding CornerRadius}"
Padding="{TemplateBinding Padding}" Foreground="{TemplateBinding Foreground}" />
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style>
<Style Selector=":is(Button).DateTimeFlyoutButtonStyle:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ThemeControlHighlightLowBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ThemeControlTransparentBrush}"/>
<Setter Property="TextElement.Foreground" Value="{DynamicResource ThemeForegroundBrush}"/>
</Style>
<Style Selector=":is(Button).DateTimeFlyoutButtonStyle:pressed /template/ ContentPresenter"> <Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ThemeControlHighlightMidBrush}"/> <Setter Property="BorderBrush" Value="{DynamicResource ThemeControlHighBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource ThemeControlTransparentBrush}"/> <Setter Property="TextBlock.Foreground" Value="{DynamicResource ThemeForegroundBrush}" />
<Setter Property="TextElement.Foreground" Value="{DynamicResource ThemeForegroundBrush}"/> </Style>
</Style>
<Style Selector="^:pressed /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="BorderBrush" Value="{DynamicResource ThemeControlLowBrush}" />
<Setter Property="Background">
<SolidColorBrush Opacity="0.6"
Color="{DynamicResource ThemeControlMidHighColor}" />
</Setter>
<Setter Property="TextBlock.Foreground" Value="{DynamicResource ThemeForegroundBrush}" />
</Style>
<Style Selector="RepeatButton.UpButton"> <Style Selector="^:disabled /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="VerticalAlignment" Value="Top"/> <Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
<Setter Property="Height" Value="22" /> </Style>
<Setter Property="HorizontalAlignment" Value="Stretch" /> </ControlTheme>
<Setter Property="Focusable" Value="False" />
<Setter Property="Background" Value="{DynamicResource ThemeControlHighlightLowBrush}" />
<Setter Property="Content">
<Template>
<Viewbox Height="10" Width="10" HorizontalAlignment="Center" VerticalAlignment="Center">
<Path Stroke="{Binding $parent[RepeatButton].Foreground}" StrokeThickness="1" Data="M 0,9 L 9,0 L 18,9"/>
</Viewbox>
</Template>
</Setter>
</Style>
<Style Selector="RepeatButton.DownButton">
<Setter Property="VerticalAlignment" Value="Bottom"/>
<Setter Property="Height" Value="22" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="Focusable" Value="False" />
<Setter Property="Background" Value="{DynamicResource ThemeControlHighlightLowBrush}" />
<Setter Property="Content">
<Template>
<Viewbox Height="10" Width="10" HorizontalAlignment="Center" VerticalAlignment="Center">
<Path Stroke="{Binding $parent[RepeatButton].Foreground}" StrokeThickness="1" Data="M 0,0 L 9,9 L 18,0"/>
</Viewbox>
</Template>
</Setter>
</Style>
<Style Selector="DatePicker"> <ControlTheme x:Key="{x:Type DatePicker}"
TargetType="DatePicker">
<Setter Property="FontSize" Value="{DynamicResource FontSizeNormal}" /> <Setter Property="FontSize" Value="{DynamicResource FontSizeNormal}" />
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" /> <Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" />
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}"/> <Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource ThemeControlHighlightMidBrush}"/> <Setter Property="BorderBrush" Value="{DynamicResource ThemeControlHighlightMidBrush}" />
<Setter Property="BorderThickness" Value="1"/> <Setter Property="BorderThickness" Value="1" />
<Setter Property="HorizontalAlignment" Value="Left" /> <Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" /> <Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Grid Name="LayoutRoot" Margin="{TemplateBinding Padding}" RowDefinitions="Auto,*"> <DataValidationErrors>
<ContentPresenter Name="HeaderContentPresenter" Grid.Row="0" <Grid Name="LayoutRoot"
Content="{TemplateBinding Header}" Margin="{TemplateBinding Padding}"
ContentTemplate="{TemplateBinding HeaderTemplate}" RowDefinitions="Auto,*">
Margin="{DynamicResource DatePickerTopHeaderMargin}" <ContentPresenter Name="HeaderContentPresenter"
MaxWidth="{DynamicResource DatePickerThemeMaxWidth}" Grid.Row="0"
HorizontalAlignment="Stretch" MaxWidth="{DynamicResource DatePickerThemeMaxWidth}"
VerticalAlignment="Top"/> Margin="{DynamicResource DatePickerTopHeaderMargin}"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
Content="{TemplateBinding Header}"
ContentTemplate="{TemplateBinding HeaderTemplate}" />
<Button Name="FlyoutButton" Grid.Row="1" <Button Name="FlyoutButton"
Foreground="{TemplateBinding Foreground}" Grid.Row="1"
Background="{TemplateBinding Background}" MinWidth="{DynamicResource DatePickerThemeMinWidth}"
BorderBrush="{TemplateBinding BorderBrush}" MaxWidth="{DynamicResource DatePickerThemeMaxWidth}"
BorderThickness="{TemplateBinding BorderThickness}" HorizontalAlignment="Stretch"
CornerRadius="{TemplateBinding CornerRadius}" VerticalAlignment="Stretch"
IsEnabled="{TemplateBinding IsEnabled}" Background="{TemplateBinding Background}"
MinWidth="{DynamicResource DatePickerThemeMinWidth}" BorderBrush="{TemplateBinding BorderBrush}"
MaxWidth="{DynamicResource DatePickerThemeMaxWidth}" BorderThickness="{TemplateBinding BorderThickness}"
HorizontalAlignment="Stretch" CornerRadius="{TemplateBinding CornerRadius}"
VerticalAlignment="Stretch" Foreground="{TemplateBinding Foreground}"
HorizontalContentAlignment="Stretch" IsEnabled="{TemplateBinding IsEnabled}"
VerticalContentAlignment="Stretch" TemplatedControl.IsTemplateFocusTarget="True"
TemplatedControl.IsTemplateFocusTarget="True"> Theme="{StaticResource DefaultDatePickerFlyoutButton}">
<Button.Template> <Grid Name="ButtonContentGrid"
<ControlTemplate> ColumnDefinitions="78*,Auto,132*,Auto,78*">
<ContentPresenter Name="ContentPresenter" <TextBlock Name="DayText"
BorderBrush="{TemplateBinding BorderBrush}" Padding="{DynamicResource DatePickerHostPadding}"
Background="{TemplateBinding Background}" HorizontalAlignment="Center"
BorderThickness="{TemplateBinding BorderThickness}" FontFamily="{TemplateBinding FontFamily}"
CornerRadius="{TemplateBinding CornerRadius}" FontSize="{TemplateBinding FontSize}"
Content="{TemplateBinding Content}" FontWeight="{TemplateBinding FontWeight}"
TextElement.Foreground="{TemplateBinding Foreground}" Text="day" />
HorizontalContentAlignment="Stretch" <TextBlock Name="MonthText"
VerticalContentAlignment="Stretch"/> Padding="{DynamicResource DatePickerHostMonthPadding}"
</ControlTemplate> FontFamily="{TemplateBinding FontFamily}"
</Button.Template> FontSize="{TemplateBinding FontSize}"
<Grid Name="ButtonContentGrid" ColumnDefinitions="78*,Auto,132*,Auto,78*"> FontWeight="{TemplateBinding FontWeight}"
<TextBlock Name="DayText" Text="day" HorizontalAlignment="Center" Text="month"
Padding="{DynamicResource DatePickerHostPadding}" TextAlignment="Left" />
FontFamily="{TemplateBinding FontFamily}" <TextBlock Name="YearText"
FontWeight="{TemplateBinding FontWeight}" Padding="{DynamicResource DatePickerHostPadding}"
FontSize="{TemplateBinding FontSize}"/> HorizontalAlignment="Center"
<TextBlock Name="MonthText" Text="month" TextAlignment="Left" FontFamily="{TemplateBinding FontFamily}"
Padding="{DynamicResource DatePickerHostMonthPadding}" FontSize="{TemplateBinding FontSize}"
FontFamily="{TemplateBinding FontFamily}" FontWeight="{TemplateBinding FontWeight}"
FontWeight="{TemplateBinding FontWeight}" Text="year" />
FontSize="{TemplateBinding FontSize}"/> <Rectangle x:Name="FirstSpacer"
<TextBlock Name="YearText" Text="year" HorizontalAlignment="Center" Grid.Column="1"
Padding="{DynamicResource DatePickerHostPadding}" Width="1"
FontFamily="{TemplateBinding FontFamily}" HorizontalAlignment="Center"
FontWeight="{TemplateBinding FontWeight}" Fill="{DynamicResource DatePickerSpacerFill}" />
FontSize="{TemplateBinding FontSize}"/> <Rectangle x:Name="SecondSpacer"
<Rectangle x:Name="FirstSpacer" Grid.Column="3"
Fill="{DynamicResource ThemeControlMidHighBrush}" Width="1"
HorizontalAlignment="Center" HorizontalAlignment="Center"
Width="1" Fill="{DynamicResource DatePickerSpacerFill}" />
Grid.Column="1" /> </Grid>
<Rectangle x:Name="SecondSpacer" </Button>
Fill="{DynamicResource ThemeControlMidHighBrush}"
HorizontalAlignment="Center"
Width="1"
Grid.Column="3" />
</Grid>
</Button>
<Popup Name="Popup" WindowManagerAddShadowHint="False" <Popup Name="Popup"
StaysOpen="False" PlacementTarget="{TemplateBinding}" IsLightDismissEnabled="True"
PlacementMode="Bottom"> PlacementMode="Bottom"
<DatePickerPresenter Name="PickerPresenter" /> PlacementTarget="{TemplateBinding}"
</Popup> WindowManagerAddShadowHint="False">
<DatePickerPresenter Name="PickerPresenter" />
</Popup>
</Grid> </Grid>
</DataValidationErrors>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style>
<Style Selector="DatePicker /template/ ContentPresenter#HeaderContentPresenter">
<Setter Property="TextElement.Foreground" Value="{DynamicResource ThemeForegroundBrush}"/>
</Style>
<Style Selector="DatePicker:disabled /template/ Rectangle">
<!--<Setter Property="Fill" Value="{DynamicResource DatePickerSpacerFillDisabled}"/>-->
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
</Style>
<Style Selector="DatePicker /template/ Button#FlyoutButton:pointerover /template/ ContentPresenter"> <Style Selector="^:disabled /template/ Rectangle">
<Setter Property="BorderBrush" Value="{DynamicResource ThemeControlHighBrush}"/> <Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
<!--<Setter Property="Background" Value="{DynamicResource DatePickerButtonBackgroundPointerOver}"/>--> </Style>
<Setter Property="TextElement.Foreground" Value="{DynamicResource ThemeForegroundBrush}"/>
</Style>
<Style Selector="DatePicker /template/ Button#FlyoutButton:pressed /template/ ContentPresenter">
<Setter Property="BorderBrush" Value="{DynamicResource ThemeControlLowBrush}"/>
<Setter Property="Background">
<SolidColorBrush Color="{DynamicResource ThemeControlMidHighColor}" Opacity="0.6" />
</Setter>
<Setter Property="TextElement.Foreground" Value="{DynamicResource ThemeForegroundBrush}"/>
</Style>
<Style Selector="DatePicker /template/ Button#FlyoutButton:disabled /template/ ContentPresenter"> <!-- Changes foreground for watermark text when SelectedDate is null -->
<!--<Setter Property="BorderBrush" Value="{DynamicResource DatePickerButtonBorderBrushDisabled}"/> <Style Selector="^:hasnodate /template/ Button#FlyoutButton TextBlock">
<Setter Property="Background" Value="{DynamicResource DatePickerButtonBackgroundDisabled}"/> <Setter Property="Foreground" Value="{DynamicResource ThemeForegroundLowBrush}" />
<Setter Property="TextElement.Foreground" Value="{DynamicResource DatePickerButtonForegroundDisabled}"/>--> </Style>
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" /> </ControlTheme>
</Style>
<!-- Changes foreground for watermark text when SelectedDate is null--> <!-- WinUI: DatePickerFlyoutPresenter -->
<Style Selector="DatePicker:hasnodate /template/ Button#FlyoutButton TextBlock"> <ControlTheme x:Key="{x:Type DatePickerPresenter}"
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundLowBrush}"/> TargetType="DatePickerPresenter">
</Style>
<!--WinUI: DatePickerFlyoutPresenter-->
<Style Selector="DatePickerPresenter">
<Setter Property="Width" Value="296" /> <Setter Property="Width" Value="296" />
<Setter Property="MinWidth" Value="296" /> <Setter Property="MinWidth" Value="296" />
<Setter Property="MaxHeight" Value="398" /> <Setter Property="MaxHeight" Value="398" />
<Setter Property="FontWeight" Value="Normal" /> <Setter Property="FontWeight" Value="Normal" />
<Setter Property="FontSize" Value="{DynamicResource FontSizeNormal}" /> <Setter Property="FontSize" Value="{DynamicResource FontSizeNormal}" />
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" /> <Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
@ -241,97 +188,126 @@
<Setter Property="BorderThickness" Value="{DynamicResource DateTimeFlyoutBorderThickness}" /> <Setter Property="BorderThickness" Value="{DynamicResource DateTimeFlyoutBorderThickness}" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Border Name="Background" Background="{TemplateBinding Background}" <Border Name="Background"
MaxHeight="398"
Padding="{DynamicResource DateTimeFlyoutBorderPadding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}" CornerRadius="{TemplateBinding CornerRadius}">
Padding="{DynamicResource DateTimeFlyoutBorderPadding}" <Grid Name="ContentRoot"
MaxHeight="398"> RowDefinitions="*,Auto">
<Grid Name="ContentRoot" RowDefinitions="*,Auto">
<Grid Name="PickerContainer"> <Grid Name="PickerContainer">
<!--Column Definitions set in code, ignore here--> <Grid.Styles>
<Style Selector="DateTimePickerPanel > ListBoxItem">
<Setter Property="Theme" Value="{StaticResource DefaultDateTimePickerItem}" />
</Style>
</Grid.Styles>
<!-- Column Definitions set in code, ignore here -->
<Panel Name="MonthHost"> <Panel Name="MonthHost">
<ScrollViewer HorizontalScrollBarVisibility="Disabled" <ScrollViewer HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Hidden"> VerticalScrollBarVisibility="Hidden">
<DateTimePickerPanel Name="MonthSelector" <DateTimePickerPanel Name="MonthSelector"
PanelType="Month" ItemHeight="{DynamicResource DatePickerFlyoutPresenterItemHeight}"
ItemHeight="{DynamicResource DatePickerFlyoutPresenterItemHeight}" PanelType="Month"
ShouldLoop="True" /> ShouldLoop="True" />
</ScrollViewer> </ScrollViewer>
<RepeatButton Name="MonthUpButton" <RepeatButton Name="MonthUpButton"
Classes="DateTimeFlyoutButtonStyle UpButton"/> Theme="{StaticResource DefaultDateTimePickerUpButton}" />
<RepeatButton Name="MonthDownButton" <RepeatButton Name="MonthDownButton"
Classes="DateTimeFlyoutButtonStyle DownButton"/> Theme="{StaticResource DefaultDateTimePickerDownButton}" />
</Panel> </Panel>
<Panel Name="DayHost"> <Panel Name="DayHost">
<ScrollViewer HorizontalScrollBarVisibility="Disabled" <ScrollViewer HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Hidden"> VerticalScrollBarVisibility="Hidden">
<DateTimePickerPanel Name="DaySelector" <DateTimePickerPanel Name="DaySelector"
PanelType="Day" ItemHeight="{DynamicResource DatePickerFlyoutPresenterItemHeight}"
ItemHeight="{DynamicResource DatePickerFlyoutPresenterItemHeight}" PanelType="Day"
ShouldLoop="True" /> ShouldLoop="True" />
</ScrollViewer> </ScrollViewer>
<RepeatButton Name="DayUpButton" <RepeatButton Name="DayUpButton"
Classes="DateTimeFlyoutButtonStyle UpButton"/> Theme="{StaticResource DefaultDateTimePickerUpButton}" />
<RepeatButton Name="DayDownButton" <RepeatButton Name="DayDownButton"
Classes="DateTimeFlyoutButtonStyle DownButton"/> Theme="{StaticResource DefaultDateTimePickerDownButton}" />
</Panel> </Panel>
<Panel Name="YearHost"> <Panel Name="YearHost">
<ScrollViewer HorizontalScrollBarVisibility="Disabled" <ScrollViewer HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Hidden"> VerticalScrollBarVisibility="Hidden">
<DateTimePickerPanel Name="YearSelector" <DateTimePickerPanel Name="YearSelector"
PanelType="Year" ItemHeight="{DynamicResource DatePickerFlyoutPresenterItemHeight}"
ItemHeight="{DynamicResource DatePickerFlyoutPresenterItemHeight}" PanelType="Year"
ShouldLoop="False" /> ShouldLoop="False" />
</ScrollViewer> </ScrollViewer>
<RepeatButton Name="YearUpButton" <RepeatButton Name="YearUpButton"
Classes="DateTimeFlyoutButtonStyle UpButton"/> Theme="{StaticResource DefaultDateTimePickerUpButton}" />
<RepeatButton Name="YearDownButton" <RepeatButton Name="YearDownButton"
Classes="DateTimeFlyoutButtonStyle DownButton"/> Theme="{StaticResource DefaultDateTimePickerDownButton}" />
</Panel> </Panel>
<Rectangle Name="HighlightRect" IsHitTestVisible="False" ZIndex="-1" <Rectangle Name="HighlightRect"
Fill="{DynamicResource DatePickerFlyoutPresenterHighlightFill}" Grid.Column="0"
Grid.Column="0" Grid.ColumnSpan="5" VerticalAlignment="Center" Grid.ColumnSpan="5"
Height="{DynamicResource DatePickerFlyoutPresenterHighlightHeight}" /> Height="{DynamicResource DatePickerFlyoutPresenterHighlightHeight}"
VerticalAlignment="Center"
IsHitTestVisible="False"
ZIndex="-1">
<Rectangle.Fill>
<SolidColorBrush Opacity="0.6"
Color="{DynamicResource ThemeAccentColor}" />
</Rectangle.Fill>
</Rectangle>
<Rectangle Name="FirstSpacer" <Rectangle Name="FirstSpacer"
Fill="{DynamicResource ThemeControlMidHighBrush}" Grid.Column="1"
HorizontalAlignment="Center"
Width="{DynamicResource DatePickerSpacerThemeWidth}" Width="{DynamicResource DatePickerSpacerThemeWidth}"
Grid.Column="1" />
<Rectangle Name="SecondSpacer"
Fill="{DynamicResource ThemeControlMidHighBrush}"
HorizontalAlignment="Center" HorizontalAlignment="Center"
Fill="{DynamicResource ThemeControlMidHighBrush}" />
<Rectangle Name="SecondSpacer"
Grid.Column="3"
Width="{DynamicResource DatePickerSpacerThemeWidth}" Width="{DynamicResource DatePickerSpacerThemeWidth}"
Grid.Column="3" /> HorizontalAlignment="Center"
Fill="{DynamicResource ThemeControlMidHighBrush}" />
</Grid> </Grid>
<Grid Grid.Row="1" Height="{DynamicResource DatePickerFlyoutPresenterAcceptDismissHostGridHeight}"
Name="AcceptDismissGrid" ColumnDefinitions="*,*"> <Grid Name="AcceptDismissGrid"
<Rectangle Height="{DynamicResource DatePickerSpacerThemeWidth}" VerticalAlignment="Top" Grid.Row="1"
Fill="{DynamicResource ThemeControlMidHighBrush}" ColumnDefinitions="*,*">
Grid.ColumnSpan="2"/> <Rectangle Grid.ColumnSpan="2"
<Button Name="AcceptButton" Grid.Column="0" Classes="DateTimeFlyoutButtonStyle" Height="{DynamicResource DatePickerSpacerThemeWidth}"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> VerticalAlignment="Top"
<Path Stroke="{Binding $parent[Button].Foreground}" StrokeLineCap="Round" Fill="{DynamicResource ThemeControlMidHighBrush}" />
StrokeThickness="0.75" Data="M0.5,8.5 5,13.5 15.5,3" /> <Button Name="AcceptButton"
Grid.Column="0"
Height="{DynamicResource DatePickerFlyoutPresenterAcceptDismissHostGridHeight}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Theme="{StaticResource DefaultDateTimePickerButton}">
<Path Data="M0.5,8.5 5,13.5 15.5,3"
Stroke="{Binding $parent[Button].Foreground}"
StrokeLineCap="Round"
StrokeThickness="0.75" />
</Button> </Button>
<Button Name="DismissButton" Grid.Column="1" Classes="DateTimeFlyoutButtonStyle" <Button Name="DismissButton"
FontSize="16" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> Grid.Column="1"
<Path Stroke="{Binding $parent[Button].Foreground}" StrokeLineCap="Round" Height="{DynamicResource DatePickerFlyoutPresenterAcceptDismissHostGridHeight}"
StrokeThickness="0.75" Data="M2,2 14,14 M2,14 14 2" /> HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Theme="{StaticResource DefaultDateTimePickerButton}">
<Path Data="M2,2 14,14 M2,14 14 2"
Stroke="{Binding $parent[Button].Foreground}"
StrokeLineCap="Round"
StrokeThickness="0.75" />
</Button> </Button>
</Grid> </Grid>
</Grid> </Grid>
</Border> </Border>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style>
<Style Selector="DatePickerPresenter /template/ Panel RepeatButton"> <Style Selector="^ /template/ Panel">
<Setter Property="IsVisible" Value="False" /> <Style Selector="^:pointerover RepeatButton">
</Style> <Setter Property="IsVisible" Value="True" />
</Style>
</Style>
</ControlTheme>
<Style Selector="DatePickerPresenter /template/ Panel:pointerover RepeatButton"> </ResourceDictionary>
<Setter Property="IsVisible" Value="True" />
</Style>
</Styles>

139
src/Avalonia.Themes.Default/Controls/DateTimePickerShared.xaml

@ -0,0 +1,139 @@
<!--
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
-->
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=netstandard"
x:CompileBindings="True">
<Design.PreviewWith>
<Border Width="200"
Padding="20">
<StackPanel Spacing="20">
<ListBoxItem Theme="{DynamicResource DefaultDateTimePickerItem}">Standard Item</ListBoxItem>
<ListBoxItem Theme="{DynamicResource DefaultDateTimePickerItem}" Classes="MonthItem">Month Item</ListBoxItem>
<RepeatButton Theme="{DynamicResource DefaultDateTimePickerButton}">Button</RepeatButton>
<RepeatButton Theme="{DynamicResource DefaultDateTimePickerUpButton}" IsVisible="True"/>
<RepeatButton Theme="{DynamicResource DefaultDateTimePickerDownButton}" IsVisible="True"/>
</StackPanel>
</Border>
</Design.PreviewWith>
<!-- Theme for the items displayed in the selectors -->
<ControlTheme x:Key="DefaultDateTimePickerItem"
BasedOn="{StaticResource {x:Type ListBoxItem}}"
TargetType="ListBoxItem">
<Setter Property="Padding" Value="{DynamicResource DatePickerFlyoutPresenterItemPadding}" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Style Selector="^:selected">
<Setter Property="IsHitTestVisible" Value="False" />
<Style Selector="^/template/ Rectangle#PressedBackground">
<Setter Property="Fill" Value="Transparent" />
</Style>
<Style Selector="^/template/ ContentPresenter">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" />
</Style>
</Style>
<Style Selector="^.MonthItem">
<Setter Property="Padding" Value="{DynamicResource DatePickerFlyoutPresenterMonthPadding}" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
</Style>
</ControlTheme>
<!-- This is used for both the accept/dismiss & repeatbuttons in the presenter -->
<ControlTheme x:Key="DefaultDateTimePickerButton"
TargetType="Button">
<Setter Property="Background" Value="{DynamicResource ThemeControlTransparentBrush}" />
<Setter Property="Height" Value="22" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<ControlTemplate>
<!--
The background is doubled here for the loopingselector up/down repeat buttons
that appear opaque. Not sure how MS does it though I suspect this is it
but source isn't MIT yet, so this is my solution
-->
<Border Background="{TemplateBinding Background}">
<ContentPresenter x:Name="ContentPresenter"
Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Background="{TemplateBinding Background}"
BorderBrush="{DynamicResource ThemeControlTransparentBrush}"
BorderThickness="{DynamicResource DateTimeFlyoutButtonBorderThickness}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
CornerRadius="{TemplateBinding CornerRadius}"
Foreground="{DynamicResource ThemeForegroundBrush}" />
</Border>
</ControlTemplate>
</Setter>
<Style Selector="^:pointerover /template/ ContentPresenter">
<Setter Property="BorderBrush" Value="{DynamicResource ThemeControlHighBrush}" />
<Setter Property="TextElement.Foreground" Value="{DynamicResource ThemeForegroundBrush}" />
</Style>
<Style Selector="^:pressed /template/ ContentPresenter">
<Setter Property="Background">
<SolidColorBrush Opacity="0.6"
Color="{DynamicResource ThemeControlMidHighColor}" />
</Setter>
<Setter Property="BorderBrush" Value="{DynamicResource ThemeControlLowBrush}" />
<Setter Property="TextElement.Foreground" Value="{DynamicResource ThemeForegroundBrush}" />
</Style>
</ControlTheme>
<ControlTheme x:Key="DefaultDateTimePickerUpButton"
BasedOn="{StaticResource DefaultDateTimePickerButton}"
TargetType="RepeatButton">
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Height" Value="22" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="Focusable" Value="False" />
<Setter Property="Background" Value="{DynamicResource ThemeControlHighlightLowBrush}" />
<Setter Property="IsVisible" Value="False" />
<Setter Property="Content">
<Template>
<Viewbox Width="10"
Height="10"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<Path Data="M 0,9 L 9,0 L 18,9"
Stroke="{Binding $parent[RepeatButton].Foreground}"
StrokeThickness="1" />
</Viewbox>
</Template>
</Setter>
</ControlTheme>
<ControlTheme x:Key="DefaultDateTimePickerDownButton"
BasedOn="{StaticResource DefaultDateTimePickerButton}"
TargetType="RepeatButton">
<Setter Property="VerticalAlignment" Value="Bottom" />
<Setter Property="Height" Value="22" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="Focusable" Value="False" />
<Setter Property="Background" Value="{DynamicResource ThemeControlHighlightLowBrush}" />
<Setter Property="IsVisible" Value="False" />
<Setter Property="Content">
<Template>
<Viewbox Width="10"
Height="10"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<Path Data="M 0,0 L 9,9 L 18,0"
Stroke="{Binding $parent[RepeatButton].Foreground}"
StrokeThickness="1" />
</Viewbox>
</Template>
</Setter>
</ControlTheme>
</ResourceDictionary>

70
src/Avalonia.Themes.Default/Controls/DropDownButton.xaml

@ -1,12 +1,14 @@
<Styles xmlns="https://github.com/avaloniaui"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Style Selector="DropDownButton"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Setter Property="Background" Value="{DynamicResource ThemeControlMidBrush}"/> <ControlTheme x:Key="{x:Type DropDownButton}"
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderLowBrush}"/> TargetType="DropDownButton">
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}"/> <Setter Property="Background" Value="{DynamicResource ThemeControlMidBrush}" />
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}"/> <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderLowBrush}" />
<Setter Property="HorizontalContentAlignment" Value="Center"/> <Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}" />
<Setter Property="VerticalContentAlignment" Value="Center"/> <Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" />
<Setter Property="Padding" Value="4"/> <Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Padding" Value="4" />
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate> <ControlTemplate>
@ -14,8 +16,8 @@
Background="{TemplateBinding Background}" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}" ClipToBounds="True"
ClipToBounds="True"> CornerRadius="{TemplateBinding CornerRadius}">
<Grid Name="InnerGrid"> <Grid Name="InnerGrid">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
@ -24,44 +26,44 @@
<ContentPresenter Name="PART_ContentPresenter" <ContentPresenter Name="PART_ContentPresenter"
Grid.Column="0" Grid.Column="0"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Padding="{TemplateBinding Padding}" Padding="{TemplateBinding Padding}"
RecognizesAccessKey="True"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" /> VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
RecognizesAccessKey="True" />
<PathIcon Name="DropDownGlyph" <PathIcon Name="DropDownGlyph"
Grid.Column="1" Grid.Column="1"
UseLayoutRounding="False"
IsHitTestVisible="False"
Height="12"
Width="12" Width="12"
Height="12"
Margin="0,0,10,0" Margin="0,0,10,0"
HorizontalAlignment="Right" HorizontalAlignment="Right"
VerticalAlignment="Center" /> VerticalAlignment="Center"
IsHitTestVisible="False"
UseLayoutRounding="False" />
</Grid> </Grid>
</Border> </Border>
</ControlTemplate> </ControlTemplate>
</Setter.Value> </Setter.Value>
</Setter> </Setter>
</Style>
<Style Selector="DropDownButton /template/ PathIcon#DropDownGlyph"> <Style Selector="^ /template/ PathIcon#DropDownGlyph">
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" /> <Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" />
<Setter Property="Data" Value="M1939 486L2029 576L1024 1581L19 576L109 486L1024 1401L1939 486Z" /> <Setter Property="Data" Value="M1939 486L2029 576L1024 1581L19 576L109 486L1024 1401L1939 486Z" />
</Style> </Style>
<Style Selector="DropDownButton:pointerover /template/ Border#RootBorder"> <Style Selector="^:pointerover /template/ Border#RootBorder">
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/> <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" />
</Style> </Style>
<Style Selector="DropDownButton:pressed /template/ Border#RootBorder"> <Style Selector="^:pressed /template/ Border#RootBorder">
<Setter Property="Background" Value="{DynamicResource ThemeControlHighBrush}"/> <Setter Property="Background" Value="{DynamicResource ThemeControlHighBrush}" />
</Style> </Style>
<Style Selector="DropDownButton:disabled"> <Style Selector="^:disabled">
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}"/> <Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
</Style> </Style>
</Styles> </ControlTheme>
</ResourceDictionary>

43
src/Avalonia.Themes.Default/Controls/EmbeddableControlRoot.xaml

@ -1,19 +1,24 @@
<Style xmlns="https://github.com/avaloniaui" Selector="EmbeddableControlRoot"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}"/> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Setter Property="FontSize" Value="{DynamicResource FontSizeNormal}"/> <ControlTheme x:Key="{x:Type EmbeddableControlRoot}"
<Setter Property="Template"> TargetType="EmbeddableControlRoot">
<ControlTemplate> <Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
<Panel> <Setter Property="FontSize" Value="{DynamicResource FontSizeNormal}" />
<Border Name="PART_TransparencyFallback" IsHitTestVisible="False" /> <Setter Property="Template">
<Border Background="{TemplateBinding Background}"> <ControlTemplate>
<VisualLayerManager> <Panel>
<ContentPresenter Name="PART_ContentPresenter" <Border Name="PART_TransparencyFallback"
ContentTemplate="{TemplateBinding ContentTemplate}" IsHitTestVisible="False" />
Content="{TemplateBinding Content}" <Border Background="{TemplateBinding Background}">
Margin="{TemplateBinding Padding}"/> <VisualLayerManager>
</VisualLayerManager> <ContentPresenter Name="PART_ContentPresenter"
</Border> Margin="{TemplateBinding Padding}"
</Panel> Content="{TemplateBinding Content}"
</ControlTemplate> ContentTemplate="{TemplateBinding ContentTemplate}" />
</Setter> </VisualLayerManager>
</Style> </Border>
</Panel>
</ControlTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>

382
src/Avalonia.Themes.Default/Controls/Expander.xaml

@ -1,196 +1,256 @@
<Styles xmlns="https://github.com/avaloniaui"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Design.PreviewWith> <Design.PreviewWith>
<Border Padding="20"> <Border Padding="20">
<StackPanel Orientation="Vertical" Spacing="20" Width="350"> <StackPanel Width="350"
<Expander ExpandDirection="Up" Header="Expand Up" CornerRadius="25"> Orientation="Vertical"
Spacing="20">
<Expander CornerRadius="25"
ExpandDirection="Up">
<Expander.Header> <Expander.Header>
<Grid ColumnDefinitions="*, Auto"> <Grid ColumnDefinitions="*, Auto">
<TextBlock Grid.Column="0" Text="Expand" /> <TextBlock Grid.Column="0"
<TextBlock Grid.Column="1" Text="Up" /> Text="Expand" />
<TextBlock Grid.Column="1"
Text="Up" />
</Grid> </Grid>
</Expander.Header> </Expander.Header>
<StackPanel> <StackPanel>
<TextBlock>Expanded content</TextBlock> <TextBlock Text="Expanded content" />
</StackPanel> </StackPanel>
</Expander> </Expander>
<Expander ExpandDirection="Down" Header="Expand Down" CornerRadius="25"> <Expander CornerRadius="25"
ExpandDirection="Down"
Header="Expand Down">
<StackPanel> <StackPanel>
<TextBlock>Expanded content</TextBlock> <TextBlock Text="Expanded content" />
</StackPanel> </StackPanel>
</Expander> </Expander>
<Expander ExpandDirection="Left" Header="Expand Left" CornerRadius="25"> <Expander CornerRadius="25"
ExpandDirection="Left"
Header="Expand Left">
<StackPanel> <StackPanel>
<TextBlock>Expanded content</TextBlock> <TextBlock Text="Expanded content" />
</StackPanel> </StackPanel>
</Expander> </Expander>
<Expander ExpandDirection="Right" Header="Expand Right" CornerRadius="25"> <Expander CornerRadius="25"
ExpandDirection="Right"
Header="Expand Right">
<StackPanel> <StackPanel>
<TextBlock>Expanded content</TextBlock> <TextBlock Text="Expanded content" />
</StackPanel> </StackPanel>
</Expander> </Expander>
</StackPanel> </StackPanel>
</Border> </Border>
</Design.PreviewWith> </Design.PreviewWith>
<Style Selector="Expander">
<Setter Property="ContentTransition"> <ControlTheme x:Key="DefaultExpanderToggleButtonTheme"
<Setter.Value> TargetType="ToggleButton">
<CrossFade Duration="00:00:00.25" />
</Setter.Value>
</Setter>
</Style>
<Style Selector="Expander[ExpandDirection=Down]">
<Setter Property="Template">
<ControlTemplate>
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<Grid RowDefinitions="Auto,*">
<ToggleButton Name="PART_toggle" Grid.Row="0"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="{TemplateBinding VerticalAlignment}"
Content="{TemplateBinding Header}" IsChecked="{TemplateBinding IsExpanded, Mode=TwoWay}" />
<ContentPresenter Name="PART_ContentPresenter"
Grid.Row="1"
IsVisible="{TemplateBinding IsExpanded}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding Content}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Padding="{TemplateBinding Padding}" />
</Grid>
</Border>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="Expander[ExpandDirection=Up]">
<Setter Property="Template">
<ControlTemplate>
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<Grid RowDefinitions="*,Auto">
<ToggleButton Name="PART_toggle" Grid.Row="1"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="{TemplateBinding VerticalAlignment}"
Content="{TemplateBinding Header}" IsChecked="{TemplateBinding IsExpanded, Mode=TwoWay}" />
<ContentPresenter Name="PART_ContentPresenter"
Grid.Row="0"
IsVisible="{TemplateBinding IsExpanded}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding Content}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Padding="{TemplateBinding Padding}" />
</Grid>
</Border>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="Expander[ExpandDirection=Right]">
<Setter Property="Template">
<ControlTemplate>
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<Grid ColumnDefinitions="Auto,*">
<ToggleButton Name="PART_toggle" Grid.Column="0"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="{TemplateBinding VerticalAlignment}"
Content="{TemplateBinding Header}" IsChecked="{TemplateBinding IsExpanded, Mode=TwoWay}" />
<ContentPresenter Name="PART_ContentPresenter"
Grid.Column="1"
IsVisible="{TemplateBinding IsExpanded}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding Content}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Padding="{TemplateBinding Padding}" />
</Grid>
</Border>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="Expander[ExpandDirection=Left]">
<Setter Property="Template">
<ControlTemplate>
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<Grid ColumnDefinitions="*,Auto">
<ToggleButton Name="PART_toggle" Grid.Column="1"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="{TemplateBinding VerticalAlignment}"
Content="{TemplateBinding Header}" IsChecked="{TemplateBinding IsExpanded, Mode=TwoWay}" />
<ContentPresenter Name="PART_ContentPresenter"
Grid.Column="0"
IsVisible="{TemplateBinding IsExpanded}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding Content}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Padding="{TemplateBinding Padding}" />
</Grid>
</Border>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="Expander /template/ ToggleButton#PART_toggle">
<Setter Property="HorizontalContentAlignment" Value="Stretch" /> <Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="Background" Value="Transparent" /> <Setter Property="Background" Value="Transparent" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Border BorderThickness="1" Background="{TemplateBinding Background}"> <Border Background="{TemplateBinding Background}"
BorderThickness="1">
<Grid ColumnDefinitions="Auto,*"> <Grid ColumnDefinitions="Auto,*">
<Border Grid.Column="0" Width="20" Height="20" HorizontalAlignment="Center" VerticalAlignment="Center"> <Border Grid.Column="0"
<Path Fill="{DynamicResource ThemeForegroundBrush}" Width="20"
HorizontalAlignment="Center" Height="20"
VerticalAlignment="Center" HorizontalAlignment="Center"
Data="M 0 2 L 4 6 L 0 10 Z" /> VerticalAlignment="Center">
<Path HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="M 0 2 L 4 6 L 0 10 Z"
Fill="{DynamicResource ThemeForegroundBrush}" />
</Border> </Border>
<ContentPresenter Name="PART_ContentPresenter" <ContentPresenter Name="PART_ContentPresenter"
Grid.Column="1" Grid.Column="1"
Background="Transparent" Padding="{TemplateBinding Padding}"
Content="{TemplateBinding Content}" VerticalAlignment="Center"
ContentTemplate="{Binding $parent[Expander].HeaderTemplate}"
VerticalAlignment="Center"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Padding="{TemplateBinding Padding}"/> Background="Transparent"
Content="{TemplateBinding Content}"
ContentTemplate="{Binding $parent[Expander].HeaderTemplate}" />
</Grid> </Grid>
</Border> </Border>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style> <Style Selector="^:pointerover /template/ Border">
<Style Selector="Expander /template/ ToggleButton#PART_toggle:pointerover /template/ Border"> <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderLowBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderLowBrush}" /> </Style>
</Style> </ControlTheme>
<Style Selector="Expander:down:expanded /template/ ToggleButton#PART_toggle /template/ Path"> <ControlTheme x:Key="DefaultExpanderToggleButtonUpTheme"
<Setter Property="RenderTransform"> BasedOn="{StaticResource DefaultExpanderToggleButtonTheme}"
<RotateTransform Angle="90" /> TargetType="ToggleButton">
</Setter> <Style Selector="^ /template/ Path">
</Style> <Setter Property="RenderTransform">
<Style Selector="Expander:up:expanded /template/ ToggleButton#PART_toggle /template/ Path"> <RotateTransform Angle="-90" />
<Setter Property="RenderTransform"> </Setter>
<RotateTransform Angle="-90" /> </Style>
</Setter> </ControlTheme>
</Style> <ControlTheme x:Key="DefaultExpanderToggleButtonDownTheme"
<Style Selector="Expander:left:expanded /template/ ToggleButton#PART_toggle /template/ Path"> BasedOn="{StaticResource DefaultExpanderToggleButtonTheme}"
<Setter Property="RenderTransform"> TargetType="ToggleButton">
<RotateTransform Angle="180" /> <Style Selector="^ /template/ Path">
</Setter> <Setter Property="RenderTransform">
</Style> <RotateTransform Angle="90" />
<Style Selector="Expander:right /template/ ToggleButton#PART_toggle /template/ Path"> </Setter>
<Setter Property="RenderTransform"> </Style>
<RotateTransform Angle="180" /> </ControlTheme>
</Setter> <ControlTheme x:Key="DefaultExpanderToggleButtonLeftTheme"
</Style> BasedOn="{StaticResource DefaultExpanderToggleButtonTheme}"
<Style Selector="Expander:right:expanded /template/ ToggleButton#PART_toggle /template/ Path"> TargetType="ToggleButton">
<Setter Property="RenderTransform"> <Style Selector="^ /template/ Path">
<RotateTransform Angle="0" /> <Setter Property="RenderTransform">
<RotateTransform Angle="180" />
</Setter>
</Style>
</ControlTheme>
<ControlTheme x:Key="DefaultExpanderToggleButtonRightTheme"
BasedOn="{StaticResource DefaultExpanderToggleButtonTheme}"
TargetType="ToggleButton">
<Style Selector="^ /template/ Path">
<Setter Property="RenderTransform">
<RotateTransform Angle="0" />
</Setter>
</Style>
</ControlTheme>
<ControlTheme x:Key="{x:Type Expander}"
TargetType="Expander">
<Setter Property="ContentTransition">
<Setter.Value>
<CrossFade Duration="00:00:00.25" />
</Setter.Value>
</Setter> </Setter>
</Style> <Style Selector="^[ExpandDirection=Down]">
</Styles> <Setter Property="Template">
<ControlTemplate>
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<Grid RowDefinitions="Auto,*">
<ToggleButton Name="PART_toggle"
Grid.Row="0"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="{TemplateBinding VerticalAlignment}"
Content="{TemplateBinding Header}"
IsChecked="{TemplateBinding IsExpanded,
Mode=TwoWay}"
Theme="{StaticResource DefaultExpanderToggleButtonRightTheme}" />
<ContentPresenter Name="PART_ContentPresenter"
Grid.Row="1"
Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
IsVisible="{TemplateBinding IsExpanded}" />
</Grid>
</Border>
</ControlTemplate>
</Setter>
<Style Selector="^:expanded /template/ ToggleButton#PART_toggle">
<Setter Property="Theme" Value="{StaticResource DefaultExpanderToggleButtonDownTheme}" />
</Style>
</Style>
<Style Selector="^[ExpandDirection=Up]">
<Setter Property="Template">
<ControlTemplate>
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<Grid RowDefinitions="*,Auto">
<ToggleButton Name="PART_toggle"
Grid.Row="1"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="{TemplateBinding VerticalAlignment}"
Content="{TemplateBinding Header}"
IsChecked="{TemplateBinding IsExpanded,
Mode=TwoWay}"
Theme="{StaticResource DefaultExpanderToggleButtonRightTheme}" />
<ContentPresenter Name="PART_ContentPresenter"
Grid.Row="0"
Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
IsVisible="{TemplateBinding IsExpanded}" />
</Grid>
</Border>
</ControlTemplate>
</Setter>
<Style Selector="^:expanded /template/ ToggleButton#PART_toggle">
<Setter Property="Theme" Value="{StaticResource DefaultExpanderToggleButtonUpTheme}" />
</Style>
</Style>
<Style Selector="^[ExpandDirection=Right]">
<Setter Property="Template">
<ControlTemplate>
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<Grid ColumnDefinitions="Auto,*">
<ToggleButton Name="PART_toggle"
Grid.Column="0"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="{TemplateBinding VerticalAlignment}"
Content="{TemplateBinding Header}"
IsChecked="{TemplateBinding IsExpanded,
Mode=TwoWay}"
Theme="{StaticResource DefaultExpanderToggleButtonLeftTheme}" />
<ContentPresenter Name="PART_ContentPresenter"
Grid.Column="1"
Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
IsVisible="{TemplateBinding IsExpanded}" />
</Grid>
</Border>
</ControlTemplate>
</Setter>
<Style Selector="^:expanded /template/ ToggleButton#PART_toggle">
<Setter Property="Theme" Value="{StaticResource DefaultExpanderToggleButtonRightTheme}" />
</Style>
</Style>
<Style Selector="^[ExpandDirection=Left]">
<Setter Property="Template">
<ControlTemplate>
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<Grid ColumnDefinitions="*,Auto">
<ToggleButton Name="PART_toggle"
Grid.Column="1"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="{TemplateBinding VerticalAlignment}"
Content="{TemplateBinding Header}"
IsChecked="{TemplateBinding IsExpanded,
Mode=TwoWay}"
Theme="{StaticResource DefaultExpanderToggleButtonRightTheme}" />
<ContentPresenter Name="PART_ContentPresenter"
Grid.Column="0"
Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
IsVisible="{TemplateBinding IsExpanded}" />
</Grid>
</Border>
</ControlTemplate>
</Setter>
<Style Selector="^:expanded /template/ ToggleButton#PART_toggle">
<Setter Property="Theme" Value="{StaticResource DefaultExpanderToggleButtonLeftTheme}" />
</Style>
</Style>
</ControlTheme>
</ResourceDictionary>

20
src/Avalonia.Themes.Default/Controls/FlyoutPresenter.xaml

@ -1,8 +1,10 @@
<Styles xmlns="https://github.com/avaloniaui"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Style Selector="FlyoutPresenter"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ControlTheme x:Key="{x:Type FlyoutPresenter}"
TargetType="FlyoutPresenter">
<Setter Property="HorizontalContentAlignment" Value="Stretch" /> <Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" /> <Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}"/> <Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" /> <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" />
<Setter Property="BorderThickness" Value="1" /> <Setter Property="BorderThickness" Value="1" />
<Setter Property="Padding" Value="4" /> <Setter Property="Padding" Value="4" />
@ -17,16 +19,16 @@
CornerRadius="{TemplateBinding CornerRadius}"> CornerRadius="{TemplateBinding CornerRadius}">
<ScrollViewer HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" <ScrollViewer HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"> VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}">
<ContentPresenter Content="{TemplateBinding Content}" <ContentPresenter Margin="{TemplateBinding Padding}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
HorizontalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch" /> VerticalContentAlignment="Stretch"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}" />
</ScrollViewer> </ScrollViewer>
</Border> </Border>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style> </ControlTheme>
</Styles> </ResourceDictionary>

9
src/Avalonia.Themes.Default/Controls/FocusAdorner.xaml

@ -1,10 +1,11 @@
<Style xmlns="https://github.com/avaloniaui" Selector=":is(Control)"> <Style xmlns="https://github.com/avaloniaui"
Selector=":is(Control)">
<Setter Property="FocusAdorner"> <Setter Property="FocusAdorner">
<FocusAdornerTemplate> <FocusAdornerTemplate>
<Rectangle Stroke="Black" <Rectangle Margin="1"
StrokeThickness="1" Stroke="Black"
StrokeDashArray="1,2" StrokeDashArray="1,2"
Margin="1"/> StrokeThickness="1" />
</FocusAdornerTemplate> </FocusAdornerTemplate>
</Setter> </Setter>
</Style> </Style>

21
src/Avalonia.Themes.Default/Controls/GridSplitter.xaml

@ -1,6 +1,7 @@
<Styles xmlns="https://github.com/avaloniaui"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style Selector="GridSplitter"> <ControlTheme x:Key="{x:Type GridSplitter}"
TargetType="GridSplitter">
<Setter Property="Focusable" Value="True" /> <Setter Property="Focusable" Value="True" />
<Setter Property="MinWidth" Value="1" /> <Setter Property="MinWidth" Value="1" />
<Setter Property="MinHeight" Value="1" /> <Setter Property="MinHeight" Value="1" />
@ -12,13 +13,11 @@
</Setter> </Setter>
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Border <Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}" CornerRadius="{TemplateBinding CornerRadius}" />
Background="{TemplateBinding Background}"/>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style> </ControlTheme>
</ResourceDictionary>
</Styles>

36
src/Avalonia.Themes.Default/Controls/ItemsControl.xaml

@ -1,16 +1,20 @@
<Style xmlns="https://github.com/avaloniaui" Selector="ItemsControl"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Setter Property="Template"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ControlTemplate> <ControlTheme x:Key="{x:Type ItemsControl}"
<Border Background="{TemplateBinding Background}" TargetType="ItemsControl">
BorderBrush="{TemplateBinding BorderBrush}" <Setter Property="Template">
BorderThickness="{TemplateBinding BorderThickness}" <ControlTemplate>
CornerRadius="{TemplateBinding CornerRadius}" <Border Padding="{TemplateBinding Padding}"
Padding="{TemplateBinding Padding}"> Background="{TemplateBinding Background}"
<ItemsPresenter Name="PART_ItemsPresenter" BorderBrush="{TemplateBinding BorderBrush}"
Items="{TemplateBinding Items}" BorderThickness="{TemplateBinding BorderThickness}"
ItemsPanel="{TemplateBinding ItemsPanel}" CornerRadius="{TemplateBinding CornerRadius}">
ItemTemplate="{TemplateBinding ItemTemplate}"/> <ItemsPresenter Name="PART_ItemsPresenter"
</Border> ItemTemplate="{TemplateBinding ItemTemplate}"
</ControlTemplate> Items="{TemplateBinding Items}"
</Setter> ItemsPanel="{TemplateBinding ItemsPanel}" />
</Style> </Border>
</ControlTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>

40
src/Avalonia.Themes.Default/Controls/Label.xaml

@ -1,18 +1,22 @@
<Style xmlns="https://github.com/avaloniaui" Selector="Label"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Setter Property="Padding" Value="3"/> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Setter Property="Template"> <ControlTheme x:Key="{x:Type Label}"
<ControlTemplate> TargetType="Label">
<ContentPresenter Name="PART_ContentPresenter" <Setter Property="Padding" Value="3" />
Background="{TemplateBinding Background}" <Setter Property="Template">
BorderBrush="{TemplateBinding BorderBrush}" <ControlTemplate>
BorderThickness="{TemplateBinding BorderThickness}" <ContentPresenter Name="PART_ContentPresenter"
CornerRadius="{TemplateBinding CornerRadius}" Padding="{TemplateBinding Padding}"
ContentTemplate="{TemplateBinding ContentTemplate}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
Content="{TemplateBinding Content}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}"
RecognizesAccessKey="True" BorderBrush="{TemplateBinding BorderBrush}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" BorderThickness="{TemplateBinding BorderThickness}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"/> Content="{TemplateBinding Content}"
</ControlTemplate> ContentTemplate="{TemplateBinding ContentTemplate}"
</Setter> CornerRadius="{TemplateBinding CornerRadius}"
</Style> RecognizesAccessKey="True" />
</ControlTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>

71
src/Avalonia.Themes.Default/Controls/ListBox.xaml

@ -1,35 +1,38 @@
<Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Style Selector="ListBox"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}"/> <ControlTheme x:Key="{x:Type ListBox}"
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/> TargetType="ListBox">
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}"/> <Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
<Setter Property="Padding" Value="4"/> <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/> <Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/> <Setter Property="Padding" Value="4" />
<Setter Property="ScrollViewer.IsScrollChainingEnabled" Value="True" /> <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
<Setter Property="Template"> <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<ControlTemplate> <Setter Property="ScrollViewer.IsScrollChainingEnabled" Value="True" />
<Border Name="border" BorderBrush="{TemplateBinding BorderBrush}" <Setter Property="Template">
BorderThickness="{TemplateBinding BorderThickness}" <ControlTemplate>
CornerRadius="{TemplateBinding CornerRadius}"> <Border Name="border"
<ScrollViewer Name="PART_ScrollViewer" BorderBrush="{TemplateBinding BorderBrush}"
Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}"
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}" CornerRadius="{TemplateBinding CornerRadius}">
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}" <ScrollViewer Name="PART_ScrollViewer"
IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}" AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}"
AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}"> Background="{TemplateBinding Background}"
<ItemsPresenter Name="PART_ItemsPresenter" HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
Items="{TemplateBinding Items}" IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}"
ItemsPanel="{TemplateBinding ItemsPanel}" VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}">
ItemTemplate="{TemplateBinding ItemTemplate}" <ItemsPresenter Name="PART_ItemsPresenter"
Margin="{TemplateBinding Padding}" Margin="{TemplateBinding Padding}"
VirtualizationMode="{TemplateBinding VirtualizationMode}"/> ItemTemplate="{TemplateBinding ItemTemplate}"
</ScrollViewer> Items="{TemplateBinding Items}"
</Border> ItemsPanel="{TemplateBinding ItemsPanel}"
</ControlTemplate> VirtualizationMode="{TemplateBinding VirtualizationMode}" />
</Setter> </ScrollViewer>
</Border>
</ControlTemplate>
</Setter>
<Style Selector="^:disabled /template/ Border#border">
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
</Style> </Style>
<Style Selector="ListBox:disabled /template/ Border#border"> </ControlTheme>
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" /> </ResourceDictionary>
</Style>
</Styles>

66
src/Avalonia.Themes.Default/Controls/ListBoxItem.xaml

@ -1,42 +1,44 @@
<Styles xmlns="https://github.com/avaloniaui"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Style Selector="ListBoxItem"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Setter Property="Background" Value="Transparent"/> <ControlTheme x:Key="{x:Type ListBoxItem}"
<Setter Property="BorderBrush" Value="Transparent"/> TargetType="ListBoxItem">
<Setter Property="BorderThickness" Value="0"/> <Setter Property="Background" Value="Transparent" />
<Setter Property="Padding" Value="2 1"/> <Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Padding" Value="2 1" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<ContentPresenter Name="PART_ContentPresenter" <ContentPresenter Name="PART_ContentPresenter"
Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Background="{TemplateBinding Background}" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding Content}" Content="{TemplateBinding Content}"
Padding="{TemplateBinding Padding}" ContentTemplate="{TemplateBinding ContentTemplate}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" CornerRadius="{TemplateBinding CornerRadius}" />
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"/>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style>
<Style Selector="ListBoxItem:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ThemeControlHighlightMidBrush}"/>
</Style>
<Style Selector="ListBoxItem:selected /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush4}"/>
</Style>
<Style Selector="ListBoxItem:selected:focus /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush3}"/>
</Style>
<Style Selector="ListBoxItem:selected:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush3}"/>
</Style>
<Style Selector="ListBoxItem:selected:focus:pointerover /template/ ContentPresenter"> <Style Selector="^:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush2}"/> <Setter Property="Background" Value="{DynamicResource ThemeControlHighlightMidBrush}" />
</Style> </Style>
</Styles>
<Style Selector="^:selected /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush4}" />
</Style>
<Style Selector="^:selected:focus /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush3}" />
</Style>
<Style Selector="^:selected:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush3}" />
</Style>
<Style Selector="^:selected:focus:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush2}" />
</Style>
</ControlTheme>
</ResourceDictionary>

319
src/Avalonia.Themes.Default/Controls/ManagedFileChooser.xaml

@ -1,153 +1,196 @@
<Styles xmlns="https://github.com/avaloniaui" <ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dialogs="clr-namespace:Avalonia.Dialogs;assembly=Avalonia.Dialogs"> xmlns:dialogs="clr-namespace:Avalonia.Dialogs;assembly=Avalonia.Dialogs">
<Style Selector="dialogs|ManagedFileChooser"> <DrawingGroup x:Key="LevelUp">
<Style.Resources> <GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" />
<ResourceDictionary> <GeometryDrawing Brush="#FFF6F6F6"
<DrawingGroup x:Key="LevelUp"> Geometry="F1M14.5,0L6.39,0 5.39,2 2.504,2C1.677,2,1,2.673,1,3.5L1,10.582 1,10.586 1,15.414 3,13.414 3,16 7,16 7,13.414 9,15.414 9,13 14.5,13C15.327,13,16,12.327,16,11.5L16,1.5C16,0.673,15.327,0,14.5,0" />
<GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" /> <GeometryDrawing Brush="#FFDCB679"
<GeometryDrawing Brush="#FFF6F6F6" Geometry="F1M14.5,0L6.39,0 5.39,2 2.504,2C1.677,2,1,2.673,1,3.5L1,10.582 1,10.586 1,15.414 3,13.414 3,16 7,16 7,13.414 9,15.414 9,13 14.5,13C15.327,13,16,12.327,16,11.5L16,1.5C16,0.673,15.327,0,14.5,0" /> Geometry="F1M14,3L7.508,3 8.008,2 8.012,2 14,2z M14.5,1L7.008,1 6.008,3 2.504,3C2.227,3,2,3.224,2,3.5L2,9.582 4.998,6.586 9,10.586 9,12 14.5,12C14.775,12,15,11.776,15,11.5L15,1.5C15,1.224,14.775,1,14.5,1" />
<GeometryDrawing Brush="#FFDCB679" Geometry="F1M14,3L7.508,3 8.008,2 8.012,2 14,2z M14.5,1L7.008,1 6.008,3 2.504,3C2.227,3,2,3.224,2,3.5L2,9.582 4.998,6.586 9,10.586 9,12 14.5,12C14.775,12,15,11.776,15,11.5L15,1.5C15,1.224,14.775,1,14.5,1" /> <GeometryDrawing Brush="#FF00529C" Geometry="F1M8,11L5,8 2,11 2,13 4,11 4,15 6,15 6,11 8,13z" />
<GeometryDrawing Brush="#FF00529C" Geometry="F1M8,11L5,8 2,11 2,13 4,11 4,15 6,15 6,11 8,13z" /> <GeometryDrawing Brush="#FFF0EFF1" Geometry="F1M8.0001,1.9996L7.5001,3.0006 14.0001,3.0006 14.0001,1.9996z" />
<GeometryDrawing Brush="#FFF0EFF1" Geometry="F1M8.0001,1.9996L7.5001,3.0006 14.0001,3.0006 14.0001,1.9996z" /> </DrawingGroup>
</DrawingGroup> <dialogs:ResourceSelectorConverter x:Key="Icons">
<dialogs:ResourceSelectorConverter x:Key="Icons"> <DrawingGroup x:Key="Icon_Folder">
<DrawingGroup x:Key="Icon_Folder"> <GeometryDrawing Brush="#00FFFFFF" Geometry="F1M0,0L16,0 16,16 0,16z" />
<GeometryDrawing Brush="#00FFFFFF" Geometry="F1M0,0L16,0 16,16 0,16z" /> <GeometryDrawing Brush="#FFF6F6F6"
<GeometryDrawing Brush="#FFF6F6F6" Geometry="F1M1.5,1L9.61,1 10.61,3 13.496,3C14.323,3,14.996,3.673,14.996,4.5L14.996,12.5C14.996,13.327,14.323,14,13.496,14L1.5,14C0.673,14,0,13.327,0,12.5L0,2.5C0,1.673,0.673,1,1.5,1" /> Geometry="F1M1.5,1L9.61,1 10.61,3 13.496,3C14.323,3,14.996,3.673,14.996,4.5L14.996,12.5C14.996,13.327,14.323,14,13.496,14L1.5,14C0.673,14,0,13.327,0,12.5L0,2.5C0,1.673,0.673,1,1.5,1" />
<GeometryDrawing Brush="#FFDCB67A" Geometry="F1M2,3L8.374,3 8.874,4 2,4z M13.496,4L10,4 9.992,4 8.992,2 1.5,2C1.225,2,1,2.224,1,2.5L1,12.5C1,12.776,1.225,13,1.5,13L13.496,13C13.773,13,13.996,12.776,13.996,12.5L13.996,4.5C13.996,4.224,13.773,4,13.496,4" /> <GeometryDrawing Brush="#FFDCB67A"
<GeometryDrawing Brush="#FFEFEFF0" Geometry="F1M2,3L8.374,3 8.874,4 2,4z" /> Geometry="F1M2,3L8.374,3 8.874,4 2,4z M13.496,4L10,4 9.992,4 8.992,2 1.5,2C1.225,2,1,2.224,1,2.5L1,12.5C1,12.776,1.225,13,1.5,13L13.496,13C13.773,13,13.996,12.776,13.996,12.5L13.996,4.5C13.996,4.224,13.773,4,13.496,4" />
</DrawingGroup> <GeometryDrawing Brush="#FFEFEFF0" Geometry="F1M2,3L8.374,3 8.874,4 2,4z" />
<DrawingGroup x:Key="Icon_File"> </DrawingGroup>
<GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" /> <DrawingGroup x:Key="Icon_File">
<GeometryDrawing Brush="#FFF6F6F6" Geometry="F1M4,15C3.03,15,2,14.299,2,13L2,3C2,1.701,3.03,1,4,1L10.061,1 14,4.556 14,13C14,13.97,13.299,15,12,15z" /> <GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" />
<GeometryDrawing Brush="#FF9B4E96" Geometry="F1M12,13L4,13 4,3 9,3 9,6 12,6z M9.641,2L3.964,2C3.964,2,3,2,3,3L3,13C3,14,3.964,14,3.964,14L11.965,14C12.965,14,13,13,13,13L13,5z" /> <GeometryDrawing Brush="#FFF6F6F6"
<GeometryDrawing Brush="#FFF0EFF1" Geometry="F1M4,3L9,3 9,6 12,6 12,13 4,13z" /> Geometry="F1M4,15C3.03,15,2,14.299,2,13L2,3C2,1.701,3.03,1,4,1L10.061,1 14,4.556 14,13C14,13.97,13.299,15,12,15z" />
</DrawingGroup> <GeometryDrawing Brush="#FF9B4E96"
<DrawingGroup x:Key="Icon_Volume"> Geometry="F1M12,13L4,13 4,3 9,3 9,6 12,6z M9.641,2L3.964,2C3.964,2,3,2,3,3L3,13C3,14,3.964,14,3.964,14L11.965,14C12.965,14,13,13,13,13L13,5z" />
<GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" /> <GeometryDrawing Brush="#FFF0EFF1" Geometry="F1M4,3L9,3 9,6 12,6 12,13 4,13z" />
<GeometryDrawing Brush="#FFF6F6F6" Geometry="F1M0,12L0,6.5C0,5.122,1.122,4,2.5,4L13.5,4C14.879,4,16,5.122,16,6.5L16,12z" /> </DrawingGroup>
<GeometryDrawing Brush="#FFEFEFF0" Geometry="F1M13,8L12,8 12,7 13,7z M11,8L10,8 10,7 11,7z M13.5,6L2.5,6C2.224,6,2,6.224,2,6.5L2,10 14,10 14,6.5C14,6.224,13.775,6,13.5,6" /> <DrawingGroup x:Key="Icon_Volume">
<GeometryDrawing Brush="#FF424242" Geometry="F1M13,7L12,7 12,8 13,8z M11,7L10,7 10,8 11,8z M2,10L14,10 14,6.5C14,6.224,13.775,6,13.5,6L2.5,6C2.224,6,2,6.224,2,6.5z M15,11L1,11 1,6.5C1,5.673,1.673,5,2.5,5L13.5,5C14.327,5,15,5.673,15,6.5z" /> <GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" />
</DrawingGroup> <GeometryDrawing Brush="#FFF6F6F6"
</dialogs:ResourceSelectorConverter> Geometry="F1M0,12L0,6.5C0,5.122,1.122,4,2.5,4L13.5,4C14.879,4,16,5.122,16,6.5L16,12z" />
</ResourceDictionary> <GeometryDrawing Brush="#FFEFEFF0"
</Style.Resources> Geometry="F1M13,8L12,8 12,7 13,7z M11,8L10,8 10,7 11,7z M13.5,6L2.5,6C2.224,6,2,6.224,2,6.5L2,10 14,10 14,6.5C14,6.224,13.775,6,13.5,6" />
<GeometryDrawing Brush="#FF424242"
Geometry="F1M13,7L12,7 12,8 13,8z M11,7L10,7 10,8 11,8z M2,10L14,10 14,6.5C14,6.224,13.775,6,13.5,6L2.5,6C2.224,6,2,6.224,2,6.5z M15,11L1,11 1,6.5C1,5.673,1.673,5,2.5,5L13.5,5C14.327,5,15,5.673,15,6.5z" />
</DrawingGroup>
</dialogs:ResourceSelectorConverter>
<ControlTheme x:Key="{x:Type dialogs:ManagedFileChooser}"
TargetType="dialogs:ManagedFileChooser">
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<DockPanel> <DockPanel>
<DockPanel DockPanel.Dock="Top" Margin="0 0 0 5"> <DockPanel Margin="0,0,0,5"
<dialogs:ChildFitter DockPanel.Dock="Right" Width="{Binding ElementName=Location, Path=Bounds.Height}"> DockPanel.Dock="Top">
<Button Command="{Binding GoUp}"> <dialogs:ChildFitter Width="{Binding ElementName=Location, Path=Bounds.Height}"
<DrawingPresenter Drawing="{StaticResource LevelUp}" Stretch="Fill"/> DockPanel.Dock="Right">
</Button> <Button Command="{Binding GoUp}">
</dialogs:ChildFitter> <Image Stretch="Fill">
<TextBox x:Name="Location" Text="{Binding Location}" Margin="0 0 5 0"> <DrawingImage Drawing="{StaticResource LevelUp}" />
<TextBox.KeyBindings> </Image>
<KeyBinding Command="{Binding EnterPressed}" Gesture="Enter"/> </Button>
</TextBox.KeyBindings> </dialogs:ChildFitter>
</TextBox> <TextBox x:Name="Location"
Margin="0,0,5,0"
Text="{Binding Location}">
<TextBox.KeyBindings>
<KeyBinding Command="{Binding EnterPressed}"
Gesture="Enter" />
</TextBox.KeyBindings>
</TextBox>
</DockPanel> </DockPanel>
<DockPanel Margin="0 5 0 0" DockPanel.Dock="Bottom"> <DockPanel Margin="0,5,0,0"
<StackPanel Orientation="Horizontal" DockPanel.Dock="Left"> DockPanel.Dock="Bottom">
<CheckBox IsChecked="{Binding ShowHiddenFiles}"> <StackPanel DockPanel.Dock="Left"
<TextBlock>Show hidden files</TextBlock> Orientation="Horizontal">
</CheckBox> <CheckBox IsChecked="{Binding ShowHiddenFiles}">
</StackPanel> <TextBlock>Show hidden files</TextBlock>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Spacing="10"> </CheckBox>
<StackPanel.Styles> </StackPanel>
<Style Selector="Button"> <StackPanel HorizontalAlignment="Right"
<Setter Property="Margin" Value="4"/> Orientation="Horizontal"
</Style> Spacing="10">
</StackPanel.Styles> <StackPanel.Styles>
<Button Command="{Binding Ok}">OK</Button> <Style Selector="Button">
<Button Command="{Binding Cancel}">Cancel</Button> <Setter Property="Margin" Value="4" />
</StackPanel> </Style>
</StackPanel.Styles>
<Button Command="{Binding Ok}">OK</Button>
<Button Command="{Binding Cancel}">Cancel</Button>
</StackPanel>
</DockPanel> </DockPanel>
<ComboBox DockPanel.Dock="Bottom" <ComboBox Margin="0,5,0,0"
IsVisible="{Binding ShowFilters}" DockPanel.Dock="Bottom"
IsVisible="{Binding ShowFilters}"
Items="{Binding Filters}" Items="{Binding Filters}"
SelectedItem="{Binding SelectedFilter}" SelectedItem="{Binding SelectedFilter}" />
Margin="0 5 0 0" />
<TextBox Text="{Binding FileName}" Watermark="File name" DockPanel.Dock="Bottom" IsVisible="{Binding !SelectingFolder}" /> <TextBox DockPanel.Dock="Bottom"
IsVisible="{Binding !SelectingFolder}"
Text="{Binding FileName}"
Watermark="File name" />
<ListBox Margin="0 0 5 5" BorderBrush="Transparent" x:Name="QuickLinks" Items="{Binding QuickLinks}" <ListBox x:Name="QuickLinks"
SelectedIndex="{Binding QuickLinksSelectedIndex}" Margin="0,0,5,5"
DockPanel.Dock="Left" Focusable="False"> BorderBrush="Transparent"
<ListBox.ItemTemplate> DockPanel.Dock="Left"
<DataTemplate> Focusable="False"
<StackPanel Spacing="4" Orientation="Horizontal" Background="Transparent"> Items="{Binding QuickLinks}"
<DrawingPresenter Width="16" Height="16" Drawing="{Binding IconKey, Converter={StaticResource Icons}}"/> SelectedIndex="{Binding QuickLinksSelectedIndex}">
<TextBlock Text="{Binding DisplayName}"/> <ListBox.ItemTemplate>
</StackPanel> <DataTemplate>
</DataTemplate> <StackPanel Background="Transparent"
</ListBox.ItemTemplate> Orientation="Horizontal"
Spacing="4">
<Image Width="16"
Height="16">
<DrawingImage Drawing="{Binding IconKey, Converter={StaticResource Icons}}" />
</Image>
<TextBlock Text="{Binding DisplayName}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox> </ListBox>
<DockPanel Grid.IsSharedSizeScope="True"> <DockPanel Grid.IsSharedSizeScope="True">
<Grid DockPanel.Dock="Top" Margin="15 5 0 0" HorizontalAlignment="Stretch"> <Grid Margin="15,5,0,0"
<Grid.ColumnDefinitions> HorizontalAlignment="Stretch"
<ColumnDefinition Width="20" SharedSizeGroup="Icon" /> DockPanel.Dock="Top">
<ColumnDefinition Width="16" SharedSizeGroup="Splitter" /> <Grid.ColumnDefinitions>
<ColumnDefinition Width="400" SharedSizeGroup="Name" /> <ColumnDefinition Width="20" SharedSizeGroup="Icon" />
<ColumnDefinition Width="16" SharedSizeGroup="Splitter" /> <ColumnDefinition Width="16" SharedSizeGroup="Splitter" />
<ColumnDefinition Width="200" SharedSizeGroup="Modified" /> <ColumnDefinition Width="400" SharedSizeGroup="Name" />
<ColumnDefinition Width="16" SharedSizeGroup="Splitter" /> <ColumnDefinition Width="16" SharedSizeGroup="Splitter" />
<ColumnDefinition Width="150" SharedSizeGroup="Type" /> <ColumnDefinition Width="200" SharedSizeGroup="Modified" />
<ColumnDefinition Width="16" SharedSizeGroup="Splitter" /> <ColumnDefinition Width="16" SharedSizeGroup="Splitter" />
<ColumnDefinition Width="200" SharedSizeGroup="Size" /> <ColumnDefinition Width="150" SharedSizeGroup="Type" />
</Grid.ColumnDefinitions> <ColumnDefinition Width="16" SharedSizeGroup="Splitter" />
<GridSplitter Grid.Column="1" /> <ColumnDefinition Width="200" SharedSizeGroup="Size" />
<TextBlock Grid.Column="2" Text="Name" /> </Grid.ColumnDefinitions>
<GridSplitter Grid.Column="3" /> <GridSplitter Grid.Column="1" />
<TextBlock Grid.Column="4" Text="Date Modified" /> <TextBlock Grid.Column="2"
<GridSplitter Grid.Column="5" /> Text="Name" />
<TextBlock Grid.Column="6" Text="Type" /> <GridSplitter Grid.Column="3" />
<GridSplitter Grid.Column="7" /> <TextBlock Grid.Column="4"
<TextBlock Grid.Column="8" Text="Size" /> Text="Date Modified" />
</Grid> <GridSplitter Grid.Column="5" />
<ListBox x:Name="Files" <TextBlock Grid.Column="6"
VirtualizationMode="Simple" Text="Type" />
Items="{Binding Items}" <GridSplitter Grid.Column="7" />
Margin="0 5" <TextBlock Grid.Column="8"
SelectionMode="{Binding SelectionMode}" Text="Size" />
SelectedItems="{Binding SelectedItems}" </Grid>
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> <ListBox x:Name="Files"
<ListBox.ItemTemplate> Margin="0,5"
<DataTemplate> Items="{Binding Items}"
<Grid Background="Transparent"> ScrollViewer.HorizontalScrollBarVisibility="Disabled"
<Grid.ColumnDefinitions> SelectedItems="{Binding SelectedItems}"
<ColumnDefinition SharedSizeGroup="Icon" /> SelectionMode="{Binding SelectionMode}"
<ColumnDefinition SharedSizeGroup="Splitter" /> VirtualizationMode="Simple">
<ColumnDefinition SharedSizeGroup="Name" /> <ListBox.ItemTemplate>
<ColumnDefinition SharedSizeGroup="Splitter" /> <DataTemplate>
<ColumnDefinition SharedSizeGroup="Modified" /> <Grid Background="Transparent">
<ColumnDefinition SharedSizeGroup="Splitter" /> <Grid.ColumnDefinitions>
<ColumnDefinition SharedSizeGroup="Type" /> <ColumnDefinition SharedSizeGroup="Icon" />
<ColumnDefinition SharedSizeGroup="Splitter" /> <ColumnDefinition SharedSizeGroup="Splitter" />
<ColumnDefinition SharedSizeGroup="Size" /> <ColumnDefinition SharedSizeGroup="Name" />
</Grid.ColumnDefinitions> <ColumnDefinition SharedSizeGroup="Splitter" />
<DrawingPresenter Width="16" Height="16" Drawing="{Binding IconKey, Converter={StaticResource Icons}}"/> <ColumnDefinition SharedSizeGroup="Modified" />
<TextBlock Grid.Column="2" Text="{Binding DisplayName}"/> <ColumnDefinition SharedSizeGroup="Splitter" />
<TextBlock Grid.Column="4" Text="{Binding Modified}" /> <ColumnDefinition SharedSizeGroup="Type" />
<TextBlock Grid.Column="6" Text="{Binding Type}" /> <ColumnDefinition SharedSizeGroup="Splitter" />
<TextBlock Grid.Column="8"> <ColumnDefinition SharedSizeGroup="Size" />
<TextBlock.Text> </Grid.ColumnDefinitions>
<Binding Path="Size"> <Image Grid.Column="0"
<Binding.Converter> Width="16"
<dialogs:FileSizeStringConverter/> Height="16">
</Binding.Converter> <DrawingImage Drawing="{Binding IconKey, Converter={StaticResource Icons}}" />
</Binding> </Image>
</TextBlock.Text> <TextBlock Grid.Column="2"
</TextBlock> Text="{Binding DisplayName}" />
</Grid> <TextBlock Grid.Column="4"
</DataTemplate> Text="{Binding Modified}" />
</ListBox.ItemTemplate> <TextBlock Grid.Column="6"
</ListBox> Text="{Binding Type}" />
<TextBlock Grid.Column="8">
<TextBlock.Text>
<Binding Path="Size">
<Binding.Converter>
<dialogs:FileSizeStringConverter />
</Binding.Converter>
</Binding>
</TextBlock.Text>
</TextBlock>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</DockPanel> </DockPanel>
</DockPanel> </DockPanel>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style> </ControlTheme>
</Styles> </ResourceDictionary>

100
src/Avalonia.Themes.Default/Controls/Menu.xaml

@ -1,17 +1,83 @@
<Style xmlns="https://github.com/avaloniaui" Selector="Menu"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Setter Property="Template"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
<ControlTemplate> xmlns:sys="using:System">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}" <ControlTheme x:Key="DefaultTopLevelMenuItem"
BorderThickness="{TemplateBinding BorderThickness}" TargetType="MenuItem">
CornerRadius="{TemplateBinding CornerRadius}" <Setter Property="Background" Value="Transparent" />
Padding="{TemplateBinding Padding}"> <Setter Property="Padding" Value="6 0" />
<ItemsPresenter Name="PART_ItemsPresenter" <Setter Property="BorderThickness" Value="1" />
Items="{TemplateBinding Items}" <Setter Property="Template">
ItemsPanel="{TemplateBinding ItemsPanel}" <ControlTemplate>
ItemTemplate="{TemplateBinding ItemTemplate}" <Border Name="root"
KeyboardNavigation.TabNavigation="Continue"/> Background="{TemplateBinding Background}"
</Border> BorderBrush="{TemplateBinding BorderBrush}"
</ControlTemplate> BorderThickness="{TemplateBinding BorderThickness}"
</Setter> CornerRadius="{TemplateBinding CornerRadius}">
</Style> <Panel>
<ContentPresenter Name="PART_HeaderPresenter"
Margin="{TemplateBinding Padding}"
Content="{TemplateBinding Header}">
<ContentPresenter.DataTemplates>
<DataTemplate DataType="sys:String">
<AccessText Text="{Binding}" />
</DataTemplate>
</ContentPresenter.DataTemplates>
</ContentPresenter>
<Popup Name="PART_Popup"
IsLightDismissEnabled="True"
IsOpen="{TemplateBinding IsSubMenuOpen,
Mode=TwoWay}"
OverlayInputPassThroughElement="{Binding $parent[Menu]}">
<Border Background="{DynamicResource ThemeBackgroundBrush}"
BorderBrush="{DynamicResource ThemeBorderMidBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<ScrollViewer Theme="{StaticResource DefaultMenuScrollViewer}">
<ItemsPresenter Name="PART_ItemsPresenter"
Margin="2"
Grid.IsSharedSizeScope="True"
ItemTemplate="{TemplateBinding ItemTemplate}"
Items="{TemplateBinding Items}"
ItemsPanel="{TemplateBinding ItemsPanel}" />
</ScrollViewer>
</Border>
</Popup>
</Panel>
</Border>
</ControlTemplate>
</Setter>
<Style Selector="^:selected /template/ Border#root">
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush4}" />
<Setter Property="BorderBrush" Value="{DynamicResource ThemeAccentBrush}" />
</Style>
<Style Selector="^:empty /template/ Path#rightArrow">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="^:disabled">
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
</Style>
</ControlTheme>
<ControlTheme x:Key="{x:Type Menu}"
TargetType="Menu">
<Setter Property="ItemContainerTheme" Value="{StaticResource DefaultTopLevelMenuItem}" />
<Setter Property="Template">
<ControlTemplate>
<Border Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<ItemsPresenter Name="PART_ItemsPresenter"
ItemTemplate="{TemplateBinding ItemTemplate}"
Items="{TemplateBinding Items}"
ItemsPanel="{TemplateBinding ItemsPanel}"
KeyboardNavigation.TabNavigation="Continue" />
</Border>
</ControlTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>

21
src/Avalonia.Themes.Default/Controls/MenuFlyoutPresenter.xaml

@ -1,6 +1,8 @@
<Styles xmlns="https://github.com/avaloniaui"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Style Selector="MenuFlyoutPresenter"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}"/> <ControlTheme x:Key="{x:Type MenuFlyoutPresenter}"
TargetType="MenuFlyoutPresenter">
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" /> <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" />
<Setter Property="BorderThickness" Value="1" /> <Setter Property="BorderThickness" Value="1" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" /> <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
@ -13,17 +15,18 @@
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"> CornerRadius="{TemplateBinding CornerRadius}">
<ScrollViewer HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" <ScrollViewer HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
Theme="{StaticResource DefaultMenuScrollViewer}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"> VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}">
<ItemsPresenter Name="PART_ItemsPresenter" <ItemsPresenter Name="PART_ItemsPresenter"
Margin="{TemplateBinding Padding}"
Grid.IsSharedSizeScope="True"
ItemTemplate="{TemplateBinding ItemTemplate}"
Items="{TemplateBinding Items}" Items="{TemplateBinding Items}"
ItemsPanel="{TemplateBinding ItemsPanel}" ItemsPanel="{TemplateBinding ItemsPanel}"
ItemTemplate="{TemplateBinding ItemTemplate}" KeyboardNavigation.TabNavigation="Continue" />
Margin="{TemplateBinding Padding}"
KeyboardNavigation.TabNavigation="Continue"
Grid.IsSharedSizeScope="True" />
</ScrollViewer> </ScrollViewer>
</Border> </Border>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style> </ControlTheme>
</Styles> </ResourceDictionary>

163
src/Avalonia.Themes.Default/Controls/MenuItem.xaml

@ -1,14 +1,14 @@
<Styles xmlns="https://github.com/avaloniaui" <ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:conv="clr-namespace:Avalonia.Controls.Converters;assembly=Avalonia.Controls" xmlns:conv="using:Avalonia.Controls.Converters"
xmlns:sys="clr-namespace:System;assembly=netstandard"> xmlns:sys="using:System">
<Styles.Resources> <conv:PlatformKeyGestureConverter x:Key="KeyGestureConverter" />
<conv:PlatformKeyGestureConverter x:Key="KeyGestureConverter"/>
</Styles.Resources> <ControlTheme x:Key="{x:Type MenuItem}"
<Style Selector="MenuItem"> TargetType="MenuItem">
<Setter Property="Background" Value="Transparent"/> <Setter Property="Background" Value="Transparent" />
<Setter Property="BorderThickness" Value="1"/> <Setter Property="BorderThickness" Value="1" />
<Setter Property="Padding" Value="6 0"/> <Setter Property="Padding" Value="6 0" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Border Name="root" <Border Name="root"
@ -18,133 +18,90 @@
CornerRadius="{TemplateBinding CornerRadius}"> CornerRadius="{TemplateBinding CornerRadius}">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="20"/> <ColumnDefinition Width="20" />
<ColumnDefinition Width="5"/> <ColumnDefinition Width="5" />
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" SharedSizeGroup="MenuItemIGT"/> <ColumnDefinition Width="Auto"
<ColumnDefinition Width="20"/> SharedSizeGroup="MenuItemIGT" />
<ColumnDefinition Width="20" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<ContentPresenter Name="icon" <ContentPresenter Name="icon"
Content="{TemplateBinding Icon}"
Width="16" Width="16"
Height="16" Height="16"
Margin="3" Margin="3"
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center"/> VerticalAlignment="Center"
Content="{TemplateBinding Icon}" />
<Path Name="check" <Path Name="check"
Fill="{TemplateBinding Foreground}"
Data="F1M10,1.2L4.7,9.1 4.5,9.1 0,5.2 1.3,3.5 4.3,6.1 8.3,0 10,1.2z"
IsVisible="False"
Margin="3" Margin="3"
VerticalAlignment="Center"/> VerticalAlignment="Center"
Data="F1M10,1.2L4.7,9.1 4.5,9.1 0,5.2 1.3,3.5 4.3,6.1 8.3,0 10,1.2z"
Fill="{TemplateBinding Foreground}"
IsVisible="False" />
<ContentPresenter Name="PART_HeaderPresenter" <ContentPresenter Name="PART_HeaderPresenter"
Content="{TemplateBinding Header}" Grid.Column="2"
Margin="{TemplateBinding Padding}" Margin="{TemplateBinding Padding}"
VerticalAlignment="Center" VerticalAlignment="Center"
Grid.Column="2"> Content="{TemplateBinding Header}">
<ContentPresenter.DataTemplates> <ContentPresenter.DataTemplates>
<DataTemplate DataType="sys:String"> <DataTemplate DataType="sys:String">
<AccessText Text="{Binding}"/> <AccessText Text="{Binding}" />
</DataTemplate> </DataTemplate>
</ContentPresenter.DataTemplates> </ContentPresenter.DataTemplates>
</ContentPresenter> </ContentPresenter>
<TextBlock x:Name="PART_InputGestureText" <TextBlock x:Name="PART_InputGestureText"
Grid.Column="3" Grid.Column="3"
Text="{TemplateBinding InputGesture, Converter={StaticResource KeyGestureConverter}}" VerticalAlignment="Center"
VerticalAlignment="Center"/> Text="{TemplateBinding InputGesture,
Converter={StaticResource KeyGestureConverter}}" />
<Path Name="rightArrow" <Path Name="rightArrow"
Data="M0,0L4,3.5 0,7z" Grid.Column="4"
Fill="{DynamicResource ThemeForegroundBrush}"
Margin="10,0,0,0" Margin="10,0,0,0"
VerticalAlignment="Center" VerticalAlignment="Center"
Grid.Column="4"/> Data="M0,0L4,3.5 0,7z"
Fill="{DynamicResource ThemeForegroundBrush}" />
<Popup Name="PART_Popup" <Popup Name="PART_Popup"
PlacementMode="Right"
IsLightDismissEnabled="False" IsLightDismissEnabled="False"
IsOpen="{TemplateBinding IsSubMenuOpen, Mode=TwoWay}"> IsOpen="{TemplateBinding IsSubMenuOpen,
<Border Background="{DynamicResource ThemeBackgroundBrush}" Mode=TwoWay}"
BorderBrush="{DynamicResource ThemeBorderMidBrush}" PlacementMode="Right">
BorderThickness="{TemplateBinding BorderThickness}">
<ScrollViewer Classes="menuscroller">
<ItemsPresenter Name="PART_ItemsPresenter"
Items="{TemplateBinding Items}"
ItemsPanel="{TemplateBinding ItemsPanel}"
ItemTemplate="{TemplateBinding ItemTemplate}"
Grid.IsSharedSizeScope="True"/>
</ScrollViewer>
</Border>
</Popup>
</Grid>
</Border>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="MenuItem:separator">
<Setter Property="Template">
<ControlTemplate>
<Separator Background="{DynamicResource ThemeControlMidBrush}"
Margin="20,1,0,1"
Height="1"/>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="Menu > MenuItem">
<Setter Property="Padding" Value="6 0"/>
<Setter Property="Template">
<ControlTemplate>
<Border Name="root"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<Panel>
<ContentPresenter Name="PART_HeaderPresenter"
Content="{TemplateBinding Header}"
Margin="{TemplateBinding Padding}">
<ContentPresenter.DataTemplates>
<DataTemplate DataType="sys:String">
<AccessText Text="{Binding}"/>
</DataTemplate>
</ContentPresenter.DataTemplates>
</ContentPresenter>
<Popup Name="PART_Popup"
IsLightDismissEnabled="True"
OverlayInputPassThroughElement="{Binding $parent[Menu]}"
IsOpen="{TemplateBinding IsSubMenuOpen, Mode=TwoWay}">
<Border Background="{DynamicResource ThemeBackgroundBrush}" <Border Background="{DynamicResource ThemeBackgroundBrush}"
BorderBrush="{DynamicResource ThemeBorderMidBrush}" BorderBrush="{DynamicResource ThemeBorderMidBrush}"
BorderThickness="{TemplateBinding BorderThickness}"> BorderThickness="{TemplateBinding BorderThickness}">
<ScrollViewer Classes="menuscroller"> <ScrollViewer Theme="{StaticResource DefaultMenuScrollViewer}">
<ItemsPresenter Name="PART_ItemsPresenter" <ItemsPresenter Name="PART_ItemsPresenter"
Items="{TemplateBinding Items}" Margin="2"
ItemsPanel="{TemplateBinding ItemsPanel}" Grid.IsSharedSizeScope="True"
ItemTemplate="{TemplateBinding ItemTemplate}" ItemTemplate="{TemplateBinding ItemTemplate}"
Grid.IsSharedSizeScope="True"/> Items="{TemplateBinding Items}"
ItemsPanel="{TemplateBinding ItemsPanel}" />
</ScrollViewer> </ScrollViewer>
</Border> </Border>
</Popup> </Popup>
</Panel> </Grid>
</Border> </Border>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style>
<Style Selector="MenuItem /template/ ItemsPresenter#PART_ItemsPresenter"> <Style Selector="^:separator">
<Setter Property="Margin" Value="2"/> <Setter Property="Template">
</Style> <ControlTemplate>
<Separator />
</ControlTemplate>
</Setter>
</Style>
<Style Selector="MenuItem:selected /template/ Border#root"> <Style Selector="^:selected /template/ Border#root">
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush4}"/> <Setter Property="Background" Value="{DynamicResource ThemeAccentBrush4}" />
<Setter Property="BorderBrush" Value="{DynamicResource ThemeAccentBrush}"/> <Setter Property="BorderBrush" Value="{DynamicResource ThemeAccentBrush}" />
</Style> </Style>
<Style Selector="MenuItem:empty /template/ Path#rightArrow"> <Style Selector="^:empty /template/ Path#rightArrow">
<Setter Property="IsVisible" Value="False"/> <Setter Property="IsVisible" Value="False" />
</Style> </Style>
<Style Selector="MenuItem:disabled"> <Style Selector="^:disabled">
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}"/> <Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
</Style> </Style>
</Styles> </ControlTheme>
</ResourceDictionary>

60
src/Avalonia.Themes.Default/Controls/NativeMenuBar.xaml

@ -1,30 +1,30 @@
<Style xmlns="https://github.com/avaloniaui" <ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Avalonia.Themes.Default" xmlns:default="clr-namespace:Avalonia.Themes.Default">
Selector="NativeMenuBar"> <default:InverseBooleanValueConverter x:Key="AvaloniaThemesDefaultNativeMenuBarInverseBooleanValueConverter"
<Style.Resources> Default="True" />
<local:InverseBooleanValueConverter x:Key="AvaloniaThemesDefaultNativeMenuBarInverseBooleanValueConverter" Default="True"/> <default:IBitmapToImageConverter x:Key="AvaloniaThemesDefaultNativeMenuBarIBitmapToImageConverter" />
<local:IBitmapToImageConverter x:Key="AvaloniaThemesDefaultNativeMenuBarIBitmapToImageConverterr"/> <ControlTheme x:Key="{x:Type NativeMenuBar}"
</Style.Resources> TargetType="NativeMenuBar">
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Menu <Menu IsVisible="{Binding $parent[TopLevel].(NativeMenu.IsNativeMenuExported), Converter={StaticResource AvaloniaThemesDefaultNativeMenuBarInverseBooleanValueConverter}}"
IsVisible="{Binding $parent[TopLevel].(NativeMenu.IsNativeMenuExported), Converter={StaticResource AvaloniaThemesDefaultNativeMenuBarInverseBooleanValueConverter}}" Items="{Binding $parent[TopLevel].(NativeMenu.Menu).Items}">
Items="{Binding $parent[TopLevel].(NativeMenu.Menu).Items}"> <Menu.Styles>
<Menu.Styles> <Style Selector="MenuItem">
<Style Selector="MenuItem"> <Setter Property="Header" Value="{Binding Header}" />
<Setter Property="Header" Value="{Binding Header}"/> <Setter Property="IsEnabled" Value="{Binding IsEnabled}" />
<Setter Property="IsEnabled" Value="{Binding IsEnabled}"/> <Setter Property="InputGesture" Value="{Binding Gesture}" />
<Setter Property="InputGesture" Value="{Binding Gesture}"/> <Setter Property="Items" Value="{Binding Menu.Items}" />
<Setter Property="Items" Value="{Binding Menu.Items}"/> <Setter Property="Command" Value="{Binding Command}" />
<Setter Property="Command" Value="{Binding Command}"/> <Setter Property="CommandParameter" Value="{Binding CommandParameter}" />
<Setter Property="CommandParameter" Value="{Binding CommandParameter}"/> <Setter Property="(NativeMenuBar.EnableMenuItemClickForwarding)" Value="True" />
<Setter Property="(NativeMenuBar.EnableMenuItemClickForwarding)" Value="True"/> <!-- NativeMenuItem is IBitmap and MenuItem is Image -->
<!--NativeMenuItem is IBitmap and MenuItem is Image--> <Setter Property="Icon" Value="{Binding Icon, Converter={StaticResource AvaloniaThemesDefaultNativeMenuBarIBitmapToImageConverter}}" />
<Setter Property="Icon" Value="{Binding Icon , Converter={StaticResource AvaloniaThemesDefaultNativeMenuBarIBitmapToImageConverterr}}"/> </Style>
</Style> </Menu.Styles>
</Menu.Styles> </Menu>
</Menu> </ControlTemplate>
</ControlTemplate> </Setter>
</Setter> </ControlTheme>
</Style> </ResourceDictionary>

171
src/Avalonia.Themes.Default/Controls/NotificationCard.xaml

@ -1,93 +1,98 @@
<Styles xmlns="https://github.com/avaloniaui" <ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style Selector="NotificationCard"> <ControlTheme x:Key="{x:Type NotificationCard}"
<Setter Property="UseLayoutRounding" Value="True"/> TargetType="NotificationCard">
<Setter Property="Width" Value="350"/> <Setter Property="Background" Value="{DynamicResource NotificationCardBackgroundBrush}" />
<Setter Property="FontSize" Value="14"/> <Setter Property="UseLayoutRounding" Value="True" />
<Setter Property="Foreground" Value="White"/> <Setter Property="Width" Value="350" />
<Setter Property="RenderTransformOrigin" Value="50%,75%"/> <Setter Property="FontSize" Value="14" />
<Setter Property="Template"> <Setter Property="Foreground" Value="White" />
<ControlTemplate> <Setter Property="RenderTransformOrigin" Value="50%,75%" />
<LayoutTransformControl Name="PART_LayoutTransformControl" UseRenderTransform="True"> <Setter Property="Template">
<Border Background="{TemplateBinding Background}" <ControlTemplate>
BorderBrush="{TemplateBinding BorderBrush}" <LayoutTransformControl Name="PART_LayoutTransformControl"
BorderThickness="{TemplateBinding BorderThickness}" UseRenderTransform="True">
CornerRadius="{TemplateBinding CornerRadius}" <Border Margin="8,8,0,0"
Margin="8,8,0,0"> Background="{TemplateBinding Background}"
<ContentControl Name="PART_Content" Content="{TemplateBinding Content}" /> BorderBrush="{TemplateBinding BorderBrush}"
</Border> BorderThickness="{TemplateBinding BorderThickness}"
</LayoutTransformControl> CornerRadius="{TemplateBinding CornerRadius}">
</ControlTemplate> <ContentControl Name="PART_Content"
</Setter> MinHeight="150"
Content="{TemplateBinding Content}" />
<Style.Animations> </Border>
<Animation Duration="0:0:0.45" Easing="QuadraticEaseIn" FillMode="Forward"> </LayoutTransformControl>
<KeyFrame Cue="0%"> </ControlTemplate>
<Setter Property="Opacity" Value="0"/> </Setter>
<Setter Property="TranslateTransform.Y" Value="20"/> <Style Selector="^">
<Setter Property="ScaleTransform.ScaleX" Value="0.85"/> <Style.Animations>
<Setter Property="ScaleTransform.ScaleY" Value="0.85"/> <Animation Easing="QuadraticEaseIn"
</KeyFrame> FillMode="Forward"
<KeyFrame Cue="30%"> Duration="0:0:0.45">
<Setter Property="TranslateTransform.Y" Value="-20"/> <KeyFrame Cue="0%">
</KeyFrame> <Setter Property="Opacity" Value="0" />
<KeyFrame Cue="100%"> <Setter Property="TranslateTransform.Y" Value="20" />
<Setter Property="Opacity" Value="1"/> <Setter Property="ScaleTransform.ScaleX" Value="0.85" />
<Setter Property="TranslateTransform.Y" Value="0"/> <Setter Property="ScaleTransform.ScaleY" Value="0.85" />
<Setter Property="ScaleTransform.ScaleX" Value="1"/> </KeyFrame>
<Setter Property="ScaleTransform.ScaleY" Value="1"/> <KeyFrame Cue="30%">
</KeyFrame> <Setter Property="TranslateTransform.Y" Value="-20" />
</Animation> </KeyFrame>
</Style.Animations> <KeyFrame Cue="100%">
</Style> <Setter Property="Opacity" Value="1" />
<Setter Property="TranslateTransform.Y" Value="0" />
<Style Selector="NotificationCard/template/ ContentControl#PART_Content"> <Setter Property="ScaleTransform.ScaleX" Value="1" />
<Setter Property="MinHeight" Value="150" /> <Setter Property="ScaleTransform.ScaleY" Value="1" />
</KeyFrame>
</Animation>
</Style.Animations>
</Style> </Style>
<Style Selector="NotificationCard[IsClosing=true] /template/ LayoutTransformControl#PART_LayoutTransformControl"> <Style Selector="^[IsClosing=true] /template/ LayoutTransformControl#PART_LayoutTransformControl">
<Setter Property="RenderTransformOrigin" Value="50%,0%"/> <Setter Property="RenderTransformOrigin" Value="50%,0%" />
<Style.Animations> <Style.Animations>
<Animation Duration="0:0:0.75" Easing="QuadraticEaseOut" FillMode="Forward"> <Animation Easing="QuadraticEaseOut"
<KeyFrame Cue="0%"> FillMode="Forward"
<Setter Property="TranslateTransform.X" Value="0"/> Duration="0:0:0.75">
<Setter Property="ScaleTransform.ScaleY" Value="1"/> <KeyFrame Cue="0%">
</KeyFrame> <Setter Property="TranslateTransform.X" Value="0" />
<KeyFrame Cue="70%"> <Setter Property="ScaleTransform.ScaleY" Value="1" />
<Setter Property="TranslateTransform.X" Value="800"/> </KeyFrame>
<Setter Property="ScaleTransform.ScaleY" Value="1"/> <KeyFrame Cue="70%">
</KeyFrame> <Setter Property="TranslateTransform.X" Value="800" />
<KeyFrame Cue="100%"> <Setter Property="ScaleTransform.ScaleY" Value="1" />
<Setter Property="ScaleTransform.ScaleY" Value="0"/> </KeyFrame>
<Setter Property="TranslateTransform.X" Value="800"/> <KeyFrame Cue="100%">
</KeyFrame> <Setter Property="ScaleTransform.ScaleY" Value="0" />
</Animation> <Setter Property="TranslateTransform.X" Value="800" />
</Style.Animations> </KeyFrame>
</Animation>
</Style.Animations>
</Style> </Style>
<Style Selector="NotificationCard[IsClosing=true]"> <Style Selector="^[IsClosing=true]">
<Style.Animations> <Style.Animations>
<Animation Duration="0:0:1.25" Easing="QuadraticEaseOut" FillMode="Forward"> <Animation Easing="QuadraticEaseOut"
<KeyFrame Cue="100%"> FillMode="Forward"
<Setter Property="IsClosed" Value="True"/> Duration="0:0:1.25">
</KeyFrame> <KeyFrame Cue="100%">
</Animation> <Setter Property="IsClosed" Value="True" />
</Style.Animations> </KeyFrame>
</Animation>
</Style.Animations>
</Style> </Style>
<Style Selector="NotificationCard"> <Style Selector="^:information">
<Setter Property="Background" Value="{DynamicResource NotificationCardBackgroundBrush}"/> <Setter Property="Background" Value="{DynamicResource NotificationCardInformationBackgroundBrush}" />
</Style>
<Style Selector="NotificationCard:information">
<Setter Property="Background" Value="{DynamicResource NotificationCardInformationBackgroundBrush}"/>
</Style> </Style>
<Style Selector="NotificationCard:success"> <Style Selector="^:success">
<Setter Property="Background" Value="{DynamicResource NotificationCardSuccessBackgroundBrush}"/> <Setter Property="Background" Value="{DynamicResource NotificationCardSuccessBackgroundBrush}" />
</Style> </Style>
<Style Selector="NotificationCard:warning"> <Style Selector="^:warning">
<Setter Property="Background" Value="{DynamicResource NotificationCardWarningBackgroundBrush}"/> <Setter Property="Background" Value="{DynamicResource NotificationCardWarningBackgroundBrush}" />
</Style> </Style>
<Style Selector="NotificationCard:error"> <Style Selector="^:error">
<Setter Property="Background" Value="{DynamicResource NotificationCardErrorBackgroundBrush}"/> <Setter Property="Background" Value="{DynamicResource NotificationCardErrorBackgroundBrush}" />
</Style> </Style>
</Styles> </ControlTheme>
</ResourceDictionary>

49
src/Avalonia.Themes.Default/Controls/NumericUpDown.xaml

@ -1,40 +1,39 @@
<Styles xmlns="https://github.com/avaloniaui"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Style Selector="NumericUpDown"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ControlTheme x:Key="{x:Type NumericUpDown}"
TargetType="NumericUpDown">
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" /> <Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/> <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" />
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}"/> <Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}" />
<Setter Property="Padding" Value="4"/> <Setter Property="Padding" Value="4" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<ButtonSpinner Name="PART_Spinner" <ButtonSpinner Name="PART_Spinner"
Background="{TemplateBinding Background}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
BorderBrush="{TemplateBinding BorderBrush}"
HorizontalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
AllowSpin="{TemplateBinding AllowSpin}" AllowSpin="{TemplateBinding AllowSpin}"
ShowButtonSpinner="{TemplateBinding ShowButtonSpinner}" Background="{TemplateBinding Background}"
ButtonSpinnerLocation="{TemplateBinding ButtonSpinnerLocation}"> BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
ButtonSpinnerLocation="{TemplateBinding ButtonSpinnerLocation}"
CornerRadius="{TemplateBinding CornerRadius}"
ShowButtonSpinner="{TemplateBinding ShowButtonSpinner}">
<TextBox Name="PART_TextBox" <TextBox Name="PART_TextBox"
BorderThickness="0" MinWidth="20"
Background="{TemplateBinding Background}" Margin="4"
Padding="{TemplateBinding Padding}" Padding="{TemplateBinding Padding}"
Watermark="{TemplateBinding Watermark}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
AcceptsReturn="False"
Background="{TemplateBinding Background}"
BorderThickness="0"
DataValidationErrors.Errors="{TemplateBinding (DataValidationErrors.Errors)}" DataValidationErrors.Errors="{TemplateBinding (DataValidationErrors.Errors)}"
IsReadOnly="{TemplateBinding IsReadOnly}" IsReadOnly="{TemplateBinding IsReadOnly}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
Text="{TemplateBinding Text}" Text="{TemplateBinding Text}"
AcceptsReturn="False" TextWrapping="NoWrap"
TextWrapping="NoWrap"> Watermark="{TemplateBinding Watermark}" />
</TextBox>
</ButtonSpinner> </ButtonSpinner>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style> </ControlTheme>
<Style Selector="NumericUpDown /template/ TextBox#PART_TextBox"> </ResourceDictionary>
<Setter Property="Margin" Value="4"/>
<Setter Property="MinWidth" Value="20"/>
</Style>
</Styles>

48
src/Avalonia.Themes.Default/Controls/OverlayPopupHost.xaml

@ -1,23 +1,25 @@
<Style xmlns="https://github.com/avaloniaui" <ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
Selector="OverlayPopupHost"> <ControlTheme x:Key="{x:Type OverlayPopupHost}"
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" /> TargetType="OverlayPopupHost">
<Setter Property="FontSize" Value="{DynamicResource FontSizeNormal}" /> <Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" />
<Setter Property="FontFamily" Value="{x:Static FontFamily.Default}" /> <Setter Property="FontSize" Value="{DynamicResource FontSizeNormal}" />
<Setter Property="FontWeight" Value="400" /> <Setter Property="FontFamily" Value="{x:Static FontFamily.Default}" />
<Setter Property="FontStyle" Value="Normal" /> <Setter Property="FontWeight" Value="400" />
<Setter Property="Template"> <Setter Property="FontStyle" Value="Normal" />
<ControlTemplate> <Setter Property="Template">
<!-- Do not forget to update Templated_Control_With_Popup_In_Template_Should_Set_TemplatedParent test --> <ControlTemplate>
<LayoutTransformControl LayoutTransform="{TemplateBinding Transform}"> <!-- Do not forget to update Templated_Control_With_Popup_In_Template_Should_Set_TemplatedParent test -->
<VisualLayerManager IsPopup="True"> <LayoutTransformControl LayoutTransform="{TemplateBinding Transform}">
<ContentPresenter Name="PART_ContentPresenter" <VisualLayerManager IsPopup="True">
Background="{TemplateBinding Background}" <ContentPresenter Name="PART_ContentPresenter"
ContentTemplate="{TemplateBinding ContentTemplate}" Padding="{TemplateBinding Padding}"
Content="{TemplateBinding Content}" Background="{TemplateBinding Background}"
Padding="{TemplateBinding Padding}"/> Content="{TemplateBinding Content}"
</VisualLayerManager> ContentTemplate="{TemplateBinding ContentTemplate}" />
</LayoutTransformControl> </VisualLayerManager>
</ControlTemplate> </LayoutTransformControl>
</Setter> </ControlTemplate>
</Style> </Setter>
</ControlTheme>
</ResourceDictionary>

21
src/Avalonia.Themes.Default/Controls/PathIcon.xaml

@ -1,21 +1,22 @@
<Styles xmlns="https://github.com/avaloniaui" <ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style Selector="PathIcon"> <ControlTheme x:Key="{x:Type PathIcon}"
TargetType="PathIcon">
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundColor}" /> <Setter Property="Foreground" Value="{DynamicResource ThemeForegroundColor}" />
<Setter Property="Background" Value="Transparent" /> <Setter Property="Background" Value="Transparent" />
<Setter Property="Height" Value="{DynamicResource IconElementThemeHeight}" /> <Setter Property="Height" Value="{DynamicResource IconElementThemeHeight}" />
<Setter Property="Width" Value="{DynamicResource IconElementThemeWidth}" /> <Setter Property="Width" Value="{DynamicResource IconElementThemeWidth}" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Border Background="{TemplateBinding Background}"> <Border Background="{TemplateBinding Background}">
<Viewbox Height="{TemplateBinding Height}" <Viewbox Width="{TemplateBinding Width}"
Width="{TemplateBinding Width}"> Height="{TemplateBinding Height}">
<Path Fill="{TemplateBinding Foreground}" <Path Data="{TemplateBinding Data}"
Data="{TemplateBinding Data}" Fill="{TemplateBinding Foreground}"
Stretch="Uniform" /> Stretch="Uniform" />
</Viewbox> </Viewbox>
</Border> </Border>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style> </ControlTheme>
</Styles> </ResourceDictionary>

57
src/Avalonia.Themes.Default/Controls/PopupRoot.xaml

@ -1,27 +1,30 @@
<Style xmlns="https://github.com/avaloniaui" <ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
Selector="PopupRoot"> <ControlTheme x:Key="{x:Type PopupRoot}"
<Setter Property="Background" Value="{x:Null}"/> TargetType="PopupRoot">
<Setter Property="TransparencyLevelHint" Value="Transparent" /> <Setter Property="Background" Value="{x:Null}" />
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}"/> <Setter Property="TransparencyLevelHint" Value="Transparent" />
<Setter Property="FontSize" Value="{DynamicResource FontSizeNormal}"/> <Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" />
<Setter Property="FontFamily" Value="{x:Static FontFamily.Default}" /> <Setter Property="FontSize" Value="{DynamicResource FontSizeNormal}" />
<Setter Property="FontWeight" Value="400" /> <Setter Property="FontFamily" Value="{x:Static FontFamily.Default}" />
<Setter Property="FontStyle" Value="Normal" /> <Setter Property="FontWeight" Value="400" />
<Setter Property="Template"> <Setter Property="FontStyle" Value="Normal" />
<ControlTemplate> <Setter Property="Template">
<LayoutTransformControl LayoutTransform="{TemplateBinding Transform}"> <ControlTemplate>
<Panel> <LayoutTransformControl LayoutTransform="{TemplateBinding Transform}">
<Border Name="PART_TransparencyFallback" IsHitTestVisible="False" /> <Panel>
<VisualLayerManager IsPopup="True"> <Border Name="PART_TransparencyFallback"
<ContentPresenter Name="PART_ContentPresenter" IsHitTestVisible="False" />
Background="{TemplateBinding Background}" <VisualLayerManager IsPopup="True">
ContentTemplate="{TemplateBinding ContentTemplate}" <ContentPresenter Name="PART_ContentPresenter"
Content="{TemplateBinding Content}" Padding="{TemplateBinding Padding}"
Padding="{TemplateBinding Padding}"/> Background="{TemplateBinding Background}"
</VisualLayerManager> Content="{TemplateBinding Content}"
</Panel> ContentTemplate="{TemplateBinding ContentTemplate}" />
</LayoutTransformControl> </VisualLayerManager>
</ControlTemplate> </Panel>
</Setter> </LayoutTransformControl>
</Style> </ControlTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>

155
src/Avalonia.Themes.Default/Controls/ProgressBar.xaml

@ -1,6 +1,6 @@
<Styles xmlns="https://github.com/avaloniaui" <ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:Avalonia.Controls.Converters;assembly=Avalonia.Controls"> xmlns:converters="clr-namespace:Avalonia.Controls.Converters;assembly=Avalonia.Controls">
<Design.PreviewWith> <Design.PreviewWith>
<Border Padding="20"> <Border Padding="20">
<StackPanel Spacing="10"> <StackPanel Spacing="10">
@ -12,30 +12,42 @@
</StackPanel> </StackPanel>
</Border> </Border>
</Design.PreviewWith> </Design.PreviewWith>
<Style Selector="ProgressBar">
<Style.Resources> <converters:StringFormatConverter x:Key="StringFormatConverter" />
<converters:StringFormatConverter x:Key="StringFormatConverter"/>
</Style.Resources> <ControlTheme x:Key="{x:Type ProgressBar}"
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush4}"/> TargetType="ProgressBar">
<Setter Property="Foreground" Value="{DynamicResource ThemeAccentBrush}"/> <Setter Property="Background" Value="{DynamicResource ThemeAccentBrush4}" />
<Setter Property="Foreground" Value="{DynamicResource ThemeAccentBrush}" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate TargetType="ProgressBar"> <ControlTemplate TargetType="ProgressBar">
<Grid> <Grid>
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{TemplateBinding CornerRadius}"> <Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<Panel> <Panel>
<Border Name="PART_Indicator" Background="{TemplateBinding Foreground}" IsVisible="{Binding !IsIndeterminate, RelativeSource={RelativeSource TemplatedParent}}"/> <Border Name="PART_Indicator"
<Border Name="PART_IndeterminateIndicator" Background="{TemplateBinding Foreground}" IsVisible="{Binding IsIndeterminate, RelativeSource={RelativeSource TemplatedParent}}"/> Background="{TemplateBinding Foreground}"
IsVisible="{Binding !IsIndeterminate, RelativeSource={RelativeSource TemplatedParent}}" />
<Border Name="PART_IndeterminateIndicator"
Background="{TemplateBinding Foreground}"
IsVisible="{Binding IsIndeterminate, RelativeSource={RelativeSource TemplatedParent}}" />
</Panel> </Panel>
</Border> </Border>
<LayoutTransformControl HorizontalAlignment="Center" VerticalAlignment="Center" IsVisible="{Binding ShowProgressText, RelativeSource={RelativeSource TemplatedParent}}" Name="PART_LayoutTransformControl"> <LayoutTransformControl Name="PART_LayoutTransformControl"
HorizontalAlignment="Center"
VerticalAlignment="Center"
IsVisible="{Binding ShowProgressText, RelativeSource={RelativeSource TemplatedParent}}">
<TextBlock Foreground="{DynamicResource ThemeForegroundBrush}"> <TextBlock Foreground="{DynamicResource ThemeForegroundBrush}">
<TextBlock.Text> <TextBlock.Text>
<MultiBinding Converter="{StaticResource StringFormatConverter}"> <MultiBinding Converter="{StaticResource StringFormatConverter}">
<TemplateBinding Property="ProgressTextFormat"/> <TemplateBinding Property="ProgressTextFormat" />
<Binding Path="Value" RelativeSource="{RelativeSource TemplatedParent}"/> <Binding Path="Value"
<TemplateBinding Property="Percentage"/> RelativeSource="{RelativeSource TemplatedParent}" />
<TemplateBinding Property="Minimum"/> <TemplateBinding Property="Percentage" />
<TemplateBinding Property="Maximum"/> <TemplateBinding Property="Minimum" />
<TemplateBinding Property="Maximum" />
</MultiBinding> </MultiBinding>
</TextBlock.Text> </TextBlock.Text>
</TextBlock> </TextBlock>
@ -43,55 +55,60 @@
</Grid> </Grid>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style>
<Style Selector="ProgressBar:horizontal /template/ Border#PART_Indicator">
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="VerticalAlignment" Value="Stretch"/>
</Style>
<Style Selector="ProgressBar:vertical /template/ Border#PART_Indicator">
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="VerticalAlignment" Value="Bottom"/>
</Style>
<Style Selector="ProgressBar:horizontal">
<Setter Property="MinWidth" Value="200"/>
<Setter Property="MinHeight" Value="16"/>
</Style>
<Style Selector="ProgressBar:vertical">
<Setter Property="MinWidth" Value="16"/>
<Setter Property="MinHeight" Value="200"/>
</Style>
<Style Selector="ProgressBar:vertical /template/ LayoutTransformControl#PART_LayoutTransformControl">
<Setter Property="LayoutTransform">
<Setter.Value>
<RotateTransform Angle="90"/>
</Setter.Value>
</Setter>
</Style>
<Style Selector="ProgressBar:horizontal:indeterminate /template/ Border#PART_IndeterminateIndicator"> <Style Selector="^:horizontal /template/ Border#PART_Indicator">
<Style.Animations> <Setter Property="HorizontalAlignment" Value="Left" />
<Animation Duration="0:0:3" IterationCount="Infinite" Easing="LinearEasing"> <Setter Property="VerticalAlignment" Value="Stretch" />
<KeyFrame Cue="0%"> </Style>
<Setter Property="TranslateTransform.X" Value="{Binding IndeterminateStartingOffset, RelativeSource={RelativeSource TemplatedParent}}" /> <Style Selector="^:vertical /template/ Border#PART_Indicator">
</KeyFrame> <Setter Property="HorizontalAlignment" Value="Stretch" />
<KeyFrame Cue="100%"> <Setter Property="VerticalAlignment" Value="Bottom" />
<Setter Property="TranslateTransform.X" Value="{Binding IndeterminateEndingOffset, RelativeSource={RelativeSource TemplatedParent}}" /> </Style>
</KeyFrame> <Style Selector="^:horizontal">
</Animation> <Setter Property="MinWidth" Value="200" />
</Style.Animations> <Setter Property="MinHeight" Value="16" />
<Setter Property="Width" Value="{Binding TemplateProperties.ContainerWidth, RelativeSource={RelativeSource TemplatedParent}}" /> </Style>
</Style> <Style Selector="^:vertical">
<Style Selector="ProgressBar:vertical:indeterminate /template/ Border#PART_IndeterminateIndicator"> <Setter Property="MinWidth" Value="16" />
<Style.Animations> <Setter Property="MinHeight" Value="200" />
<Animation Duration="0:0:3" IterationCount="Infinite" Easing="LinearEasing"> </Style>
<KeyFrame Cue="0%"> <Style Selector="^:vertical /template/ LayoutTransformControl#PART_LayoutTransformControl">
<Setter Property="TranslateTransform.Y" Value="{Binding IndeterminateStartingOffset, RelativeSource={RelativeSource TemplatedParent}}" /> <Setter Property="LayoutTransform">
</KeyFrame> <Setter.Value>
<KeyFrame Cue="100%"> <RotateTransform Angle="90" />
<Setter Property="TranslateTransform.Y" Value="{Binding IndeterminateEndingOffset, RelativeSource={RelativeSource TemplatedParent}}" /> </Setter.Value>
</KeyFrame> </Setter>
</Animation> </Style>
</Style.Animations>
<Setter Property="Height" Value="{Binding TemplateProperties.ContainerWidth, RelativeSource={RelativeSource TemplatedParent}}" /> <Style Selector="^:horizontal:indeterminate /template/ Border#PART_IndeterminateIndicator">
</Style> <Style.Animations>
</Styles> <Animation Easing="LinearEasing"
IterationCount="Infinite"
Duration="0:0:3">
<KeyFrame Cue="0%">
<Setter Property="TranslateTransform.X" Value="{Binding IndeterminateStartingOffset, RelativeSource={RelativeSource TemplatedParent}}" />
</KeyFrame>
<KeyFrame Cue="100%">
<Setter Property="TranslateTransform.X" Value="{Binding IndeterminateEndingOffset, RelativeSource={RelativeSource TemplatedParent}}" />
</KeyFrame>
</Animation>
</Style.Animations>
<Setter Property="Width" Value="{Binding TemplateProperties.ContainerWidth, RelativeSource={RelativeSource TemplatedParent}}" />
</Style>
<Style Selector="^:vertical:indeterminate /template/ Border#PART_IndeterminateIndicator">
<Style.Animations>
<Animation Easing="LinearEasing"
IterationCount="Infinite"
Duration="0:0:3">
<KeyFrame Cue="0%">
<Setter Property="TranslateTransform.Y" Value="{Binding IndeterminateStartingOffset, RelativeSource={RelativeSource TemplatedParent}}" />
</KeyFrame>
<KeyFrame Cue="100%">
<Setter Property="TranslateTransform.Y" Value="{Binding IndeterminateEndingOffset, RelativeSource={RelativeSource TemplatedParent}}" />
</KeyFrame>
</Animation>
</Style.Animations>
<Setter Property="Height" Value="{Binding TemplateProperties.ContainerWidth, RelativeSource={RelativeSource TemplatedParent}}" />
</Style>
</ControlTheme>
</ResourceDictionary>

87
src/Avalonia.Themes.Default/Controls/RadioButton.xaml

@ -1,61 +1,64 @@
<Styles xmlns="https://github.com/avaloniaui"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Style Selector="RadioButton"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Setter Property="Background" Value="Transparent"/> <ControlTheme x:Key="{x:Type RadioButton}"
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/> TargetType="RadioButton">
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}"/> <Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" />
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Grid ColumnDefinitions="Auto,*" Background="{TemplateBinding Background}"> <Grid Background="{TemplateBinding Background}"
ColumnDefinitions="Auto,*">
<Ellipse Name="border" <Ellipse Name="border"
Stroke="{TemplateBinding BorderBrush}"
StrokeThickness="1"
Width="18" Width="18"
Height="18" Height="18"
VerticalAlignment="Center"/> VerticalAlignment="Center"
Stroke="{TemplateBinding BorderBrush}"
StrokeThickness="1" />
<Ellipse Name="checkMark" <Ellipse Name="checkMark"
Width="10" Width="10"
Height="10" Height="10"
Stretch="Uniform"
UseLayoutRounding="False"
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center"/> VerticalAlignment="Center"
Stretch="Uniform"
UseLayoutRounding="False" />
<Ellipse Name="indeterminateMark" <Ellipse Name="indeterminateMark"
Fill="{DynamicResource ThemeAccentBrush}"
Width="10" Width="10"
Height="10" Height="10"
Stretch="Uniform"
UseLayoutRounding="False"
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center"/> VerticalAlignment="Center"
Fill="{DynamicResource ThemeAccentBrush}"
Stretch="Uniform"
UseLayoutRounding="False" />
<ContentPresenter Name="PART_ContentPresenter" <ContentPresenter Name="PART_ContentPresenter"
ContentTemplate="{TemplateBinding ContentTemplate}" Grid.Column="1"
Content="{TemplateBinding Content}"
Margin="4,0,0,0" Margin="4,0,0,0"
RecognizesAccessKey="True"
VerticalAlignment="Center" VerticalAlignment="Center"
Grid.Column="1"/> Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
RecognizesAccessKey="True" />
</Grid> </Grid>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style>
<Style Selector="^:pointerover /template/ Ellipse#border">
<Style Selector="RadioButton:pointerover /template/ Ellipse#border"> <Setter Property="Stroke" Value="{DynamicResource ThemeBorderHighBrush}" />
<Setter Property="Stroke" Value="{DynamicResource ThemeBorderHighBrush}"/> </Style>
</Style> <Style Selector="^ /template/ Ellipse#checkMark">
<Style Selector="RadioButton /template/ Ellipse#checkMark"> <Setter Property="Fill" Value="{DynamicResource HighlightBrush}" />
<Setter Property="Fill" Value="{DynamicResource HighlightBrush}"/> <Setter Property="IsVisible" Value="False" />
<Setter Property="IsVisible" Value="False"/> </Style>
</Style> <Style Selector="^ /template/ Ellipse#indeterminateMark">
<Style Selector="RadioButton /template/ Ellipse#indeterminateMark"> <Setter Property="IsVisible" Value="False" />
<Setter Property="IsVisible" Value="False"/> </Style>
</Style> <Style Selector="^:checked /template/ Ellipse#checkMark">
<Style Selector="RadioButton:checked /template/ Ellipse#checkMark"> <Setter Property="IsVisible" Value="True" />
<Setter Property="IsVisible" Value="True"/> </Style>
</Style> <Style Selector="^:indeterminate /template/ Ellipse#indeterminateMark">
<Style Selector="RadioButton:indeterminate /template/ Ellipse#indeterminateMark"> <Setter Property="IsVisible" Value="True" />
<Setter Property="IsVisible" Value="True"/> </Style>
</Style> <Style Selector="^:disabled /template/ Ellipse#border">
<Style Selector="RadioButton:disabled /template/ Ellipse#border"> <Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}"/> </Style>
</Style> </ControlTheme>
</Styles> </ResourceDictionary>

71
src/Avalonia.Themes.Default/Controls/RepeatButton.xaml

@ -1,41 +1,34 @@
<Styles xmlns="https://github.com/avaloniaui"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Style Selector="RepeatButton"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Setter Property="Background" <ControlTheme x:Key="{x:Type RepeatButton}"
Value="{DynamicResource ThemeControlMidBrush}" /> TargetType="RepeatButton">
<Setter Property="BorderBrush" <Setter Property="Background" Value="{DynamicResource ThemeControlMidBrush}" />
Value="{DynamicResource ThemeBorderLowBrush}" /> <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderLowBrush}" />
<Setter Property="BorderThickness" <Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}" />
Value="{DynamicResource ThemeBorderThickness}" /> <Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" />
<Setter Property="Foreground" <Setter Property="HorizontalContentAlignment" Value="Center" />
Value="{DynamicResource ThemeForegroundBrush}" /> <Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" <Setter Property="Padding" Value="4" />
Value="Center" /> <Setter Property="Template">
<Setter Property="VerticalContentAlignment" <ControlTemplate>
Value="Center" /> <ContentPresenter Name="PART_ContentPresenter"
<Setter Property="Padding" Padding="{TemplateBinding Padding}"
Value="4" /> HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
<Setter Property="Template"> VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
<ControlTemplate> Background="{TemplateBinding Background}"
<ContentPresenter Name="PART_ContentPresenter" BorderBrush="{TemplateBinding BorderBrush}"
Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="{TemplateBinding BorderBrush}" Content="{TemplateBinding Content}"
BorderThickness="{TemplateBinding BorderThickness}" ContentTemplate="{TemplateBinding ContentTemplate}"
CornerRadius="{TemplateBinding CornerRadius}" CornerRadius="{TemplateBinding CornerRadius}"
ContentTemplate="{TemplateBinding ContentTemplate}" TextElement.Foreground="{TemplateBinding Foreground}" />
Content="{TemplateBinding Content}" </ControlTemplate>
Padding="{TemplateBinding Padding}" </Setter>
TextElement.Foreground="{TemplateBinding Foreground}" <Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" />
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
</ControlTemplate>
</Setter>
</Style> </Style>
<Style Selector="RepeatButton:pointerover /template/ ContentPresenter"> <Style Selector="^:disabled">
<Setter Property="BorderBrush" <Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
Value="{DynamicResource ThemeBorderMidBrush}" />
</Style> </Style>
<Style Selector="RepeatButton:disabled"> </ControlTheme>
<Setter Property="Opacity" </ResourceDictionary>
Value="{DynamicResource ThemeDisabledOpacity}" />
</Style>
</Styles>

18
src/Avalonia.Themes.Default/Controls/RichTextBlock.xaml

@ -1,10 +1,14 @@
<Styles xmlns="https://github.com/avaloniaui" <ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Design.PreviewWith> <Design.PreviewWith>
<RichTextBlock IsTextSelectionEnabled="True" Text="Preview"/> <RichTextBlock IsTextSelectionEnabled="True"
</Design.PreviewWith> Text="Preview" />
</Design.PreviewWith>
<Style Selector="RichTextBlock[IsTextSelectionEnabled=true]"> <ControlTheme x:Key="{x:Type RichTextBlock}"
TargetType="RichTextBlock">
<Style Selector="^[IsTextSelectionEnabled=True]">
<Setter Property="Cursor" Value="IBeam" /> <Setter Property="Cursor" Value="IBeam" />
</Style> </Style>
</Styles> </ControlTheme>
</ResourceDictionary>

283
src/Avalonia.Themes.Default/Controls/ScrollBar.xaml

@ -1,142 +1,151 @@
<Styles xmlns="https://github.com/avaloniaui"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Style Selector="ScrollBar"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ControlTheme x:Key="{x:Type ScrollBar}"
TargetType="ScrollBar">
<Setter Property="Cursor" Value="Arrow" /> <Setter Property="Cursor" Value="Arrow" />
<Setter Property="Template">
<ControlTemplate> <Style Selector="^:horizontal">
<Border Background="{DynamicResource ThemeControlMidBrush}" <Setter Property="Height" Value="{DynamicResource ScrollBarThickness}" />
UseLayoutRounding="False"> <Setter Property="Template">
<Grid RowDefinitions="Auto,*,Auto"> <ControlTemplate>
<RepeatButton Name="PART_LineUpButton" HorizontalAlignment="Center" <Border Background="{DynamicResource ThemeControlMidBrush}"
Classes="repeat" UseLayoutRounding="False">
Grid.Row="0" <Grid ColumnDefinitions="Auto,*,Auto">
Focusable="False" <RepeatButton Name="PART_LineUpButton"
MinHeight="{DynamicResource ScrollBarThickness}"> Grid.Row="0"
<Path Data="M 0 4 L 8 4 L 4 0 Z" /> Grid.Column="0"
</RepeatButton> MinWidth="{DynamicResource ScrollBarThickness}"
<Track Grid.Row="1" VerticalAlignment="Center"
Grid.Column="1" Classes="repeat"
Minimum="{TemplateBinding Minimum}" Focusable="False">
Maximum="{TemplateBinding Maximum}" <Path Data="M 4 0 L 4 8 L 0 4 Z" />
Value="{TemplateBinding Value, Mode=TwoWay}" </RepeatButton>
ViewportSize="{TemplateBinding ViewportSize}" <Track Grid.Row="1"
Orientation="{TemplateBinding Orientation}" Grid.Column="1"
IsDirectionReversed="True"> Maximum="{TemplateBinding Maximum}"
<Track.DecreaseButton> Minimum="{TemplateBinding Minimum}"
<RepeatButton Name="PART_PageUpButton" Orientation="{TemplateBinding Orientation}"
Classes="repeattrack" ViewportSize="{TemplateBinding ViewportSize}"
Focusable="False"/> Value="{TemplateBinding Value,
</Track.DecreaseButton> Mode=TwoWay}">
<Track.IncreaseButton> <Track.DecreaseButton>
<RepeatButton Name="PART_PageDownButton" <RepeatButton Name="PART_PageUpButton"
Classes="repeattrack" Classes="repeattrack"
Focusable="False"/> Focusable="False" />
</Track.IncreaseButton> </Track.DecreaseButton>
<Thumb Name="thumb"/> <Track.IncreaseButton>
</Track> <RepeatButton Name="PART_PageDownButton"
<RepeatButton Name="PART_LineDownButton" HorizontalAlignment="Center" Classes="repeattrack"
Classes="repeat" Focusable="False" />
Grid.Row="2" </Track.IncreaseButton>
Grid.Column="2" <Thumb Name="thumb" />
Focusable="False" </Track>
MinHeight="{DynamicResource ScrollBarThickness}"> <RepeatButton Name="PART_LineDownButton"
<Path Data="M 0 0 L 4 4 L 8 0 Z" /> Grid.Row="2"
</RepeatButton> Grid.Column="2"
</Grid> MinWidth="{DynamicResource ScrollBarThickness}"
</Border> VerticalAlignment="Center"
</ControlTemplate> Classes="repeat"
</Setter> Focusable="False">
</Style> <Path Data="M 0 0 L 4 4 L 0 8 Z" />
<Style Selector="ScrollBar:horizontal"> </RepeatButton>
<Setter Property="Height" Value="{DynamicResource ScrollBarThickness}" /> </Grid>
<Setter Property="Template"> </Border>
<ControlTemplate> </ControlTemplate>
<Border Background="{DynamicResource ThemeControlMidBrush}" </Setter>
UseLayoutRounding="False"> </Style>
<Grid ColumnDefinitions="Auto,*,Auto"> <Style Selector="^:vertical">
<RepeatButton Name="PART_LineUpButton" VerticalAlignment="Center" <Setter Property="Width" Value="{DynamicResource ScrollBarThickness}" />
Classes="repeat" <Setter Property="Template">
Grid.Row="0" <ControlTemplate>
Grid.Column="0" <Border Background="{DynamicResource ThemeControlMidBrush}"
Focusable="False" UseLayoutRounding="False">
MinWidth="{DynamicResource ScrollBarThickness}"> <Grid RowDefinitions="Auto,*,Auto">
<Path Data="M 4 0 L 4 8 L 0 4 Z" /> <RepeatButton Name="PART_LineUpButton"
</RepeatButton> Grid.Row="0"
<Track Grid.Row="1" MinHeight="{DynamicResource ScrollBarThickness}"
Grid.Column="1" HorizontalAlignment="Center"
Minimum="{TemplateBinding Minimum}" Classes="repeat"
Maximum="{TemplateBinding Maximum}" Focusable="False">
Value="{TemplateBinding Value, Mode=TwoWay}" <Path Data="M 0 4 L 8 4 L 4 0 Z" />
ViewportSize="{TemplateBinding ViewportSize}" </RepeatButton>
Orientation="{TemplateBinding Orientation}"> <Track Grid.Row="1"
<Track.DecreaseButton> Grid.Column="1"
<RepeatButton Name="PART_PageUpButton" IsDirectionReversed="True"
Classes="repeattrack" Maximum="{TemplateBinding Maximum}"
Focusable="False"/> Minimum="{TemplateBinding Minimum}"
</Track.DecreaseButton> Orientation="{TemplateBinding Orientation}"
<Track.IncreaseButton> ViewportSize="{TemplateBinding ViewportSize}"
<RepeatButton Name="PART_PageDownButton" Value="{TemplateBinding Value,
Classes="repeattrack" Mode=TwoWay}">
Focusable="False"/> <Track.DecreaseButton>
</Track.IncreaseButton> <RepeatButton Name="PART_PageUpButton"
<Thumb Name="thumb"/> Classes="repeattrack"
</Track> Focusable="False" />
<RepeatButton Name="PART_LineDownButton" VerticalAlignment="Center" </Track.DecreaseButton>
Classes="repeat" <Track.IncreaseButton>
Grid.Row="2" <RepeatButton Name="PART_PageDownButton"
Grid.Column="2" Classes="repeattrack"
Focusable="False" Focusable="False" />
MinWidth="{DynamicResource ScrollBarThickness}"> </Track.IncreaseButton>
<Path Data="M 0 0 L 4 4 L 0 8 Z" /> <Thumb Name="thumb" />
</RepeatButton> </Track>
</Grid> <RepeatButton Name="PART_LineDownButton"
</Border> Grid.Row="2"
</ControlTemplate> Grid.Column="2"
</Setter> MinHeight="{DynamicResource ScrollBarThickness}"
</Style> HorizontalAlignment="Center"
<Style Selector="ScrollBar /template/ Thumb#thumb"> Classes="repeat"
<Setter Property="Background" Value="{DynamicResource ThemeControlMidHighBrush}"/> Focusable="False">
<Setter Property="Template"> <Path Data="M 0 0 L 4 4 L 8 0 Z" />
<Setter.Value> </RepeatButton>
</Grid>
</Border>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="^ /template/ Thumb#thumb">
<Setter Property="Background" Value="{DynamicResource ThemeControlMidHighBrush}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border Background="{TemplateBinding Background}" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style Selector="^ /template/ Thumb#thumb:pointerover">
<Setter Property="Background" Value="{DynamicResource ThemeControlHighBrush}" />
</Style>
<Style Selector="^ /template/ Thumb#thumb:pressed">
<Setter Property="Background" Value="{DynamicResource ThemeControlVeryHighBrush}" />
</Style>
<Style Selector="^:horizontal /template/ Thumb#thumb">
<Setter Property="MinWidth" Value="{DynamicResource ScrollBarThickness}" />
<Setter Property="Height" Value="{DynamicResource ScrollBarThumbThickness}" />
</Style>
<Style Selector="^:vertical /template/ Thumb#thumb">
<Setter Property="MinHeight" Value="{DynamicResource ScrollBarThickness}" />
<Setter Property="Width" Value="{DynamicResource ScrollBarThumbThickness}" />
</Style>
<Style Selector="^ /template/ RepeatButton.repeat">
<Setter Property="Padding" Value="2" />
<Setter Property="BorderThickness" Value="0" />
</Style>
<Style Selector="^ /template/ RepeatButton.repeattrack">
<Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Border Background="{TemplateBinding Background}"/> <Border Background="{TemplateBinding Background}" />
</ControlTemplate> </ControlTemplate>
</Setter.Value> </Setter>
</Setter> </Style>
</Style>
<Style Selector="ScrollBar /template/ Thumb#thumb:pointerover">
<Setter Property="Background" Value="{DynamicResource ThemeControlHighBrush}"/>
</Style>
<Style Selector="ScrollBar /template/ Thumb#thumb:pressed">
<Setter Property="Background" Value="{DynamicResource ThemeControlVeryHighBrush}"/>
</Style>
<Style Selector="ScrollBar:horizontal /template/ Thumb#thumb">
<Setter Property="MinWidth" Value="{DynamicResource ScrollBarThickness}" />
<Setter Property="Height" Value="{DynamicResource ScrollBarThumbThickness}" />
</Style>
<Style Selector="ScrollBar:vertical">
<Setter Property="Width" Value="{DynamicResource ScrollBarThickness}" />
</Style>
<Style Selector="ScrollBar:vertical /template/ Thumb#thumb">
<Setter Property="MinHeight" Value="{DynamicResource ScrollBarThickness}" />
<Setter Property="Width" Value="{DynamicResource ScrollBarThumbThickness}" />
</Style>
<Style Selector="ScrollBar /template/ RepeatButton.repeat">
<Setter Property="Padding" Value="2" />
<Setter Property="BorderThickness" Value="0" />
</Style>
<Style Selector="ScrollBar /template/ RepeatButton.repeattrack">
<Setter Property="Template">
<ControlTemplate>
<Border Background="{TemplateBinding Background}" />
</ControlTemplate>
</Setter>
</Style>
<Style Selector="ScrollBar /template/ RepeatButton > Path"> <Style Selector="^ /template/ RepeatButton > Path">
<Setter Property="Fill" Value="{DynamicResource ThemeForegroundLowBrush}" /> <Setter Property="Fill" Value="{DynamicResource ThemeForegroundLowBrush}" />
</Style> </Style>
<Style Selector="ScrollBar /template/ RepeatButton:pointerover > Path"> <Style Selector="^ /template/ RepeatButton:pointerover > Path">
<Setter Property="Fill" Value="{DynamicResource ThemeAccentBrush}" /> <Setter Property="Fill" Value="{DynamicResource ThemeAccentBrush}" />
</Style> </Style>
</Styles> </ControlTheme>
</ResourceDictionary>

133
src/Avalonia.Themes.Default/Controls/ScrollViewer.xaml

@ -1,106 +1,125 @@
<Styles xmlns="https://github.com/avaloniaui" <ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:Avalonia.Controls.Converters;assembly=Avalonia.Controls"> xmlns:converters="using:Avalonia.Controls.Converters">
<Style Selector="ScrollViewer"> <ControlTheme x:Key="{x:Type ScrollViewer}"
<Setter Property="Background" TargetType="ScrollViewer">
Value="Transparent" /> <Setter Property="Background" Value="Transparent" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Grid ColumnDefinitions="*,Auto" RowDefinitions="*,Auto"> <Grid ColumnDefinitions="*,Auto"
RowDefinitions="*,Auto">
<ScrollContentPresenter Name="PART_ContentPresenter" <ScrollContentPresenter Name="PART_ContentPresenter"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}" Background="{TemplateBinding Background}"
CanHorizontallyScroll="{TemplateBinding CanHorizontallyScroll}" CanHorizontallyScroll="{TemplateBinding CanHorizontallyScroll}"
CanVerticallyScroll="{TemplateBinding CanVerticallyScroll}" CanVerticallyScroll="{TemplateBinding CanVerticallyScroll}"
Content="{TemplateBinding Content}" Content="{TemplateBinding Content}"
Extent="{TemplateBinding Extent, Mode=TwoWay}" Extent="{TemplateBinding Extent,
Padding="{TemplateBinding Padding}" Mode=TwoWay}"
Offset="{TemplateBinding Offset, Mode=TwoWay}" IsScrollChainingEnabled="{TemplateBinding IsScrollChainingEnabled}"
Viewport="{TemplateBinding Viewport, Mode=TwoWay}" Viewport="{TemplateBinding Viewport,
IsScrollChainingEnabled="{TemplateBinding IsScrollChainingEnabled}"> Mode=TwoWay}"
Offset="{TemplateBinding Offset,
Mode=TwoWay}">
<ScrollContentPresenter.GestureRecognizers> <ScrollContentPresenter.GestureRecognizers>
<ScrollGestureRecognizer <ScrollGestureRecognizer CanHorizontallyScroll="{TemplateBinding CanHorizontallyScroll}"
CanHorizontallyScroll="{TemplateBinding CanHorizontallyScroll}" CanVerticallyScroll="{TemplateBinding CanVerticallyScroll}" />
CanVerticallyScroll="{TemplateBinding CanVerticallyScroll}"
/>
</ScrollContentPresenter.GestureRecognizers> </ScrollContentPresenter.GestureRecognizers>
</ScrollContentPresenter> </ScrollContentPresenter>
<ScrollBar Name="horizontalScrollBar" <ScrollBar Name="horizontalScrollBar"
Orientation="Horizontal" Grid.Row="1"
Focusable="False"
LargeChange="{Binding LargeChange.Width, RelativeSource={RelativeSource TemplatedParent}}" LargeChange="{Binding LargeChange.Width, RelativeSource={RelativeSource TemplatedParent}}"
SmallChange="{Binding SmallChange.Width, RelativeSource={RelativeSource TemplatedParent}}"
Maximum="{TemplateBinding HorizontalScrollBarMaximum}" Maximum="{TemplateBinding HorizontalScrollBarMaximum}"
Value="{TemplateBinding HorizontalScrollBarValue, Mode=TwoWay}" Orientation="Horizontal"
SmallChange="{Binding SmallChange.Width, RelativeSource={RelativeSource TemplatedParent}}"
ViewportSize="{TemplateBinding HorizontalScrollBarViewportSize}" ViewportSize="{TemplateBinding HorizontalScrollBarViewportSize}"
Visibility="{TemplateBinding HorizontalScrollBarVisibility}" Visibility="{TemplateBinding HorizontalScrollBarVisibility}"
Grid.Row="1" Value="{TemplateBinding HorizontalScrollBarValue,
Focusable="False"/> Mode=TwoWay}" />
<ScrollBar Name="verticalScrollBar" <ScrollBar Name="verticalScrollBar"
Orientation="Vertical" Grid.Column="1"
Focusable="False"
LargeChange="{Binding LargeChange.Height, RelativeSource={RelativeSource TemplatedParent}}" LargeChange="{Binding LargeChange.Height, RelativeSource={RelativeSource TemplatedParent}}"
SmallChange="{Binding SmallChange.Height, RelativeSource={RelativeSource TemplatedParent}}"
Maximum="{TemplateBinding VerticalScrollBarMaximum}" Maximum="{TemplateBinding VerticalScrollBarMaximum}"
Value="{TemplateBinding VerticalScrollBarValue, Mode=TwoWay}" Orientation="Vertical"
SmallChange="{Binding SmallChange.Height, RelativeSource={RelativeSource TemplatedParent}}"
ViewportSize="{TemplateBinding VerticalScrollBarViewportSize}" ViewportSize="{TemplateBinding VerticalScrollBarViewportSize}"
Visibility="{TemplateBinding VerticalScrollBarVisibility}" Visibility="{TemplateBinding VerticalScrollBarVisibility}"
Grid.Column="1" Value="{TemplateBinding VerticalScrollBarValue,
Focusable="False"/> Mode=TwoWay}" />
<Panel Grid.Row="1" Grid.Column="1" Background="{DynamicResource ThemeControlMidBrush}"/> <Panel Grid.Row="1"
Grid.Column="1"
Background="{DynamicResource ThemeControlMidBrush}" />
</Grid> </Grid>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style> </ControlTheme>
<Style Selector="ScrollViewer.menuscroller"> <ControlTheme x:Key="DefaultMenuScrollViewer"
TargetType="ScrollViewer">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<DockPanel> <DockPanel>
<RepeatButton DockPanel.Dock="Top" <RepeatButton Background="Transparent"
BorderThickness="0" BorderThickness="0"
Background="Transparent" Command="{Binding LineUp, RelativeSource={RelativeSource TemplatedParent}}"
Command="{Binding LineUp, RelativeSource={RelativeSource TemplatedParent}}"> DockPanel.Dock="Top">
<RepeatButton.IsVisible> <RepeatButton.IsVisible>
<MultiBinding Converter="{x:Static converters:MenuScrollingVisibilityConverter.Instance}" <MultiBinding Converter="{x:Static converters:MenuScrollingVisibilityConverter.Instance}"
ConverterParameter="0"> ConverterParameter="0">
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="VerticalScrollBarVisibility"/> <Binding Path="VerticalScrollBarVisibility"
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="Offset.Y"/> RelativeSource="{RelativeSource TemplatedParent}" />
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="Extent.Height"/> <Binding Path="Offset.Y"
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="Viewport.Height"/> RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="Extent.Height"
RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="Viewport.Height"
RelativeSource="{RelativeSource TemplatedParent}" />
</MultiBinding> </MultiBinding>
</RepeatButton.IsVisible> </RepeatButton.IsVisible>
<Path Data="M 0 4 L 8 4 L 4 0 Z"/> <Path Data="M 0 4 L 8 4 L 4 0 Z" />
</RepeatButton> </RepeatButton>
<RepeatButton DockPanel.Dock="Bottom" <RepeatButton Background="Transparent"
BorderThickness="0" BorderThickness="0"
Background="Transparent" Command="{Binding LineDown, RelativeSource={RelativeSource TemplatedParent}}"
Command="{Binding LineDown, RelativeSource={RelativeSource TemplatedParent}}"> DockPanel.Dock="Bottom">
<RepeatButton.IsVisible> <RepeatButton.IsVisible>
<MultiBinding Converter="{x:Static converters:MenuScrollingVisibilityConverter.Instance}" <MultiBinding Converter="{x:Static converters:MenuScrollingVisibilityConverter.Instance}"
ConverterParameter="100"> ConverterParameter="100">
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="VerticalScrollBarVisibility"/> <Binding Path="VerticalScrollBarVisibility"
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="Offset.Y"/> RelativeSource="{RelativeSource TemplatedParent}" />
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="Extent.Height"/> <Binding Path="Offset.Y"
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="Viewport.Height"/> RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="Extent.Height"
RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="Viewport.Height"
RelativeSource="{RelativeSource TemplatedParent}" />
</MultiBinding> </MultiBinding>
</RepeatButton.IsVisible> </RepeatButton.IsVisible>
<Path Data="M 0 0 L 4 4 L 8 0 Z"/> <Path Data="M 0 0 L 4 4 L 8 0 Z" />
</RepeatButton> </RepeatButton>
<ScrollContentPresenter Name="PART_ContentPresenter" <ScrollContentPresenter Name="PART_ContentPresenter"
Margin="{TemplateBinding Padding}"
CanHorizontallyScroll="{TemplateBinding CanHorizontallyScroll}" CanHorizontallyScroll="{TemplateBinding CanHorizontallyScroll}"
CanVerticallyScroll="{TemplateBinding CanVerticallyScroll}" CanVerticallyScroll="{TemplateBinding CanVerticallyScroll}"
Content="{TemplateBinding Content}" Content="{TemplateBinding Content}"
Extent="{TemplateBinding Extent, Mode=TwoWay}" Extent="{TemplateBinding Extent,
Margin="{TemplateBinding Padding}" Mode=TwoWay}"
Offset="{TemplateBinding Offset, Mode=TwoWay}" Viewport="{TemplateBinding Viewport,
Viewport="{TemplateBinding Viewport, Mode=TwoWay}"/> Mode=TwoWay}"
Offset="{TemplateBinding Offset,
Mode=TwoWay}" />
</DockPanel> </DockPanel>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style> <Style Selector="^ /template/ RepeatButton > Path">
<Style Selector="ScrollViewer.menuscroller /template/ RepeatButton > Path"> <Setter Property="Fill" Value="{DynamicResource ThemeForegroundLowBrush}" />
<Setter Property="Fill" Value="{DynamicResource ThemeForegroundLowBrush}" /> </Style>
</Style>
<Style Selector="ScrollViewer.menuscroller /template/ RepeatButton:pointerover > Path"> <Style Selector="^ /template/ RepeatButton:pointerover > Path">
<Setter Property="Fill" Value="{DynamicResource ThemeAccentBrush}" /> <Setter Property="Fill" Value="{DynamicResource ThemeAccentBrush}" />
</Style> </Style>
</Styles> </ControlTheme>
</ResourceDictionary>

28
src/Avalonia.Themes.Default/Controls/Separator.xaml

@ -1,21 +1,19 @@
<Styles xmlns="https://github.com/avaloniaui"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style Selector="Separator"> <ControlTheme x:Key="{x:Type Separator}"
<Setter Property="Focusable" Value="False"/> TargetType="Separator">
<Setter Property="Focusable" Value="False" />
<Setter Property="Background" Value="{DynamicResource ThemeControlMidBrush}" />
<Setter Property="Margin" Value="29,1,0,1" />
<Setter Property="Height" Value="1" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Border BorderBrush="{TemplateBinding BorderBrush}" <Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}" CornerRadius="{TemplateBinding CornerRadius}" />
Background="{TemplateBinding Background}"/>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style> </ControlTheme>
<Style Selector="MenuItem > Separator, ContextMenu > Separator">
<Setter Property="Background" Value="{DynamicResource ThemeControlMidBrush}"/>
<Setter Property="Margin" Value="29,1,0,1"/>
<Setter Property="Height" Value="1"/>
</Style>
</Styles> </ResourceDictionary>

213
src/Avalonia.Themes.Default/Controls/Slider.xaml

@ -1,97 +1,128 @@
<Styles xmlns="https://github.com/avaloniaui"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Style Selector="Slider:horizontal"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Setter Property="MinWidth" Value="40"/> <ControlTheme x:Key="SliderRepeatTrackTheme"
<Setter Property="MinHeight" Value="20"/> TargetType="RepeatButton">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Focusable" Value="False" />
<Setter Property="Foreground" Value="{DynamicResource ThemeBorderLowBrush}" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Grid Name="grid"> <Border Background="{TemplateBinding Background}" />
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto" MinHeight="20"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Border Name="TrackBackground" Grid.Row="1" Height="4" Margin="6,0" VerticalAlignment="Center"/>
<Track Name="PART_Track" Grid.Row="1" IsDirectionReversed="{TemplateBinding IsDirectionReversed}" Orientation="Horizontal">
<Track.DecreaseButton>
<RepeatButton Name="PART_DecreaseButton"
Classes="repeattrack" />
</Track.DecreaseButton>
<Track.IncreaseButton>
<RepeatButton Name="PART_IncreaseButton"
Classes="repeattrack" />
</Track.IncreaseButton>
<Thumb Name="thumb" MinWidth="20" MinHeight="20">
<Thumb.Template>
<ControlTemplate>
<Grid>
<Ellipse Width="12" Height="12" Fill="{DynamicResource ThemeAccentBrush}"/>
</Grid>
</ControlTemplate>
</Thumb.Template>
</Thumb>
</Track>
</Grid>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style> </ControlTheme>
<Style Selector="Slider:vertical">
<Setter Property="MinWidth" Value="20"/> <ControlTheme x:Key="{x:Type Slider}"
<Setter Property="MinHeight" Value="40"/> TargetType="Slider">
<Setter Property="Template"> <Style Selector="^:horizontal">
<ControlTemplate> <Setter Property="MinWidth" Value="40" />
<Grid> <Setter Property="MinHeight" Value="20" />
<Grid.ColumnDefinitions> <Setter Property="Template">
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto" MinWidth="26"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Border Name="TrackBackground" Grid.Column="1" Width="4" Margin="0,6" HorizontalAlignment="Center"/>
<Track Name="PART_Track" Grid.Column="1" IsDirectionReversed="{TemplateBinding IsDirectionReversed}" Orientation="Vertical">
<Track.DecreaseButton>
<RepeatButton Name="PART_DecreaseButton"
Classes="repeattrack" />
</Track.DecreaseButton>
<Track.IncreaseButton>
<RepeatButton Name="PART_IncreaseButton"
Classes="repeattrack" />
</Track.IncreaseButton>
<Thumb Name="thumb" MinWidth="20" MinHeight="20">
<Thumb.Template>
<ControlTemplate>
<Grid>
<Ellipse Width="12" Height="12" Fill="{DynamicResource ThemeAccentBrush}"/>
</Grid>
</ControlTemplate>
</Thumb.Template>
</Thumb>
</Track>
</Grid>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="Slider /template/ Track#PART_Track">
<Setter Property="Minimum" Value="{TemplateBinding Minimum}"/>
<Setter Property="Maximum" Value="{TemplateBinding Maximum}"/>
<Setter Property="Value" Value="{TemplateBinding Value, Mode=TwoWay}"/>
</Style>
<Style Selector="Slider /template/ Border#TrackBackground">
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderLowBrush}"/>
</Style>
<Style Selector="Slider /template/ RepeatButton.repeattrack">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Focusable" Value="False"/>
<Setter Property="Foreground" Value="{DynamicResource ThemeBorderLowBrush}"/>
<Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Border Background="{TemplateBinding Background}" /> <Grid Name="grid">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto"
MinHeight="20" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Border Name="TrackBackground"
Grid.Row="1"
Height="4"
Margin="6,0"
VerticalAlignment="Center" />
<Track Name="PART_Track"
Grid.Row="1"
IsDirectionReversed="{TemplateBinding IsDirectionReversed}"
Orientation="Horizontal">
<Track.DecreaseButton>
<RepeatButton Name="PART_DecreaseButton"
Theme="{StaticResource SliderRepeatTrackTheme}" />
</Track.DecreaseButton>
<Track.IncreaseButton>
<RepeatButton Name="PART_IncreaseButton"
Theme="{StaticResource SliderRepeatTrackTheme}" />
</Track.IncreaseButton>
<Thumb Name="thumb"
MinWidth="20"
MinHeight="20">
<Thumb.Template>
<ControlTemplate>
<Grid>
<Ellipse Width="12"
Height="12"
Fill="{DynamicResource ThemeAccentBrush}" />
</Grid>
</ControlTemplate>
</Thumb.Template>
</Thumb>
</Track>
</Grid>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style> </Style>
<Style Selector="Slider /template/ TickBar"> <Style Selector="^:vertical">
<Setter Property="Ticks" Value="{TemplateBinding Ticks}" /> <Setter Property="MinWidth" Value="20" />
</Style> <Setter Property="MinHeight" Value="40" />
<Style Selector="Slider:disabled /template/ Grid#grid"> <Setter Property="Template">
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" /> <ControlTemplate>
</Style> <Grid>
</Styles> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto"
MinWidth="26" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Border Name="TrackBackground"
Grid.Column="1"
Width="4"
Margin="0,6"
HorizontalAlignment="Center" />
<Track Name="PART_Track"
Grid.Column="1"
IsDirectionReversed="{TemplateBinding IsDirectionReversed}"
Orientation="Vertical">
<Track.DecreaseButton>
<RepeatButton Name="PART_DecreaseButton"
Theme="{StaticResource SliderRepeatTrackTheme}" />
</Track.DecreaseButton>
<Track.IncreaseButton>
<RepeatButton Name="PART_IncreaseButton"
Theme="{StaticResource SliderRepeatTrackTheme}" />
</Track.IncreaseButton>
<Thumb Name="thumb"
MinWidth="20"
MinHeight="20">
<Thumb.Template>
<ControlTemplate>
<Grid>
<Ellipse Width="12"
Height="12"
Fill="{DynamicResource ThemeAccentBrush}" />
</Grid>
</ControlTemplate>
</Thumb.Template>
</Thumb>
</Track>
</Grid>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="^ /template/ Track#PART_Track">
<Setter Property="Minimum" Value="{TemplateBinding Minimum}" />
<Setter Property="Maximum" Value="{TemplateBinding Maximum}" />
<Setter Property="Value" Value="{TemplateBinding Value, Mode=TwoWay}" />
</Style>
<Style Selector="^ /template/ Border#TrackBackground">
<Setter Property="BorderThickness" Value="2" />
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderLowBrush}" />
</Style>
<Style Selector="^ /template/ TickBar">
<Setter Property="Ticks" Value="{TemplateBinding Ticks}" />
</Style>
<Style Selector="^:disabled /template/ Grid#grid">
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
</Style>
</ControlTheme>
</ResourceDictionary>

444
src/Avalonia.Themes.Default/Controls/SplitButton.xaml

@ -1,9 +1,9 @@
<Styles xmlns="https://github.com/avaloniaui" <ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:CompileBindings="True" x:CompileBindings="True"
xmlns:converters="using:Avalonia.Controls.Converters"> xmlns:converters="using:Avalonia.Controls.Converters">
<!-- This style is heavily based on the Fluent v1 style. <!-- This style is heavily based on the Default v1 style.
The base resources are switched out along with a few minor changes such as Padding, CornerRadius. --> The base resources are switched out along with a few minor changes such as Padding, CornerRadius. -->
<Design.PreviewWith> <Design.PreviewWith>
@ -12,50 +12,127 @@
</Border> </Border>
</Design.PreviewWith> </Design.PreviewWith>
<Styles.Resources> <x:Double x:Key="SplitButtonPrimaryButtonSize">24</x:Double>
<x:Double x:Key="SplitButtonPrimaryButtonSize">24</x:Double> <x:Double x:Key="SplitButtonSecondaryButtonSize">24</x:Double>
<x:Double x:Key="SplitButtonSecondaryButtonSize">24</x:Double> <x:Double x:Key="SplitButtonSeparatorWidth">1</x:Double>
<x:Double x:Key="SplitButtonSeparatorWidth">1</x:Double> <x:Double x:Key="SplitButtonMinHeight">24</x:Double>
<x:Double x:Key="SplitButtonMinHeight">24</x:Double> <Thickness x:Key="SplitButtonBorderThemeThickness">1</Thickness>
<Thickness x:Key="SplitButtonBorderThemeThickness">1</Thickness>
<converters:MarginMultiplierConverter x:Key="PrimaryButtonBorderMultiplier" Left="True" Top="True" Bottom="True"
<converters:MarginMultiplierConverter x:Key="PrimaryButtonBorderMultiplier" Left="True" Top="True" Bottom="True" Indent="1" /> Indent="1" />
<converters:MarginMultiplierConverter x:Key="SecondaryButtonBorderMultiplier" Right="True" Top="True" Bottom="True" Indent="1" /> <converters:MarginMultiplierConverter x:Key="SecondaryButtonBorderMultiplier" Right="True" Top="True" Bottom="True"
<converters:MarginMultiplierConverter x:Key="SeparatorBorderMultiplier" Top="True" Bottom="True" Indent="1" /> Indent="1" />
<converters:CornerRadiusFilterConverter x:Key="TopCornerRadiusFilterConverter" Filter="TopLeft, TopRight"/> <converters:MarginMultiplierConverter x:Key="SeparatorBorderMultiplier" Top="True" Bottom="True" Indent="1" />
<converters:CornerRadiusFilterConverter x:Key="RightCornerRadiusFilterConverter" Filter="TopRight, BottomRight"/> <converters:CornerRadiusFilterConverter x:Key="TopCornerRadiusFilterConverter" Filter="TopLeft, TopRight" />
<converters:CornerRadiusFilterConverter x:Key="BottomCornerRadiusFilterConverter" Filter="BottomLeft, BottomRight"/> <converters:CornerRadiusFilterConverter x:Key="RightCornerRadiusFilterConverter" Filter="TopRight, BottomRight" />
<converters:CornerRadiusFilterConverter x:Key="LeftCornerRadiusFilterConverter" Filter="TopLeft, BottomLeft"/> <converters:CornerRadiusFilterConverter x:Key="BottomCornerRadiusFilterConverter" Filter="BottomLeft, BottomRight" />
<converters:CornerRadiusFilterConverter x:Key="LeftCornerRadiusFilterConverter" Filter="TopLeft, BottomLeft" />
<SolidColorBrush x:Key="SplitButtonBackground" Color="{DynamicResource ThemeControlMidColor}" />
<SolidColorBrush x:Key="SplitButtonBackgroundPointerOver" Color="{DynamicResource ThemeControlMidColor}" /> <SolidColorBrush x:Key="SplitButtonBackground" Color="{DynamicResource ThemeControlMidColor}" />
<SolidColorBrush x:Key="SplitButtonBackgroundPressed" Color="{DynamicResource ThemeBorderHighColor}" /> <SolidColorBrush x:Key="SplitButtonBackgroundPointerOver" Color="{DynamicResource ThemeControlMidColor}" />
<SolidColorBrush x:Key="SplitButtonBackgroundDisabled" Color="{DynamicResource ThemeControlMidColor}" Opacity="{DynamicResource ThemeDisabledOpacity}" /> <SolidColorBrush x:Key="SplitButtonBackgroundPressed" Color="{DynamicResource ThemeBorderHighColor}" />
<SolidColorBrush x:Key="SplitButtonBackgroundChecked" Color="{DynamicResource ThemeBorderHighColor}" /> <SolidColorBrush x:Key="SplitButtonBackgroundDisabled" Color="{DynamicResource ThemeControlMidColor}"
<SolidColorBrush x:Key="SplitButtonBackgroundCheckedPointerOver" Color="{DynamicResource ThemeBorderHighColor}" /> Opacity="{DynamicResource ThemeDisabledOpacity}" />
<SolidColorBrush x:Key="SplitButtonBackgroundCheckedPressed" Color="{DynamicResource ThemeBorderHighColor}" /> <SolidColorBrush x:Key="SplitButtonBackgroundChecked" Color="{DynamicResource ThemeBorderHighColor}" />
<SolidColorBrush x:Key="SplitButtonBackgroundCheckedDisabled" Color="{DynamicResource ThemeControlHighColor}" Opacity="{DynamicResource ThemeDisabledOpacity}" /> <SolidColorBrush x:Key="SplitButtonBackgroundCheckedPointerOver" Color="{DynamicResource ThemeBorderHighColor}" />
<SolidColorBrush x:Key="SplitButtonBackgroundCheckedPressed" Color="{DynamicResource ThemeBorderHighColor}" />
<SolidColorBrush x:Key="SplitButtonForeground" Color="{DynamicResource ThemeForegroundColor}" /> <SolidColorBrush x:Key="SplitButtonBackgroundCheckedDisabled" Color="{DynamicResource ThemeControlHighColor}"
<SolidColorBrush x:Key="SplitButtonForegroundPointerOver" Color="{DynamicResource ThemeForegroundColor}" /> Opacity="{DynamicResource ThemeDisabledOpacity}" />
<SolidColorBrush x:Key="SplitButtonForegroundPressed" Color="{DynamicResource ThemeForegroundColor}" />
<SolidColorBrush x:Key="SplitButtonForegroundDisabled" Color="{DynamicResource ThemeForegroundColor}" /> <SolidColorBrush x:Key="SplitButtonForeground" Color="{DynamicResource ThemeForegroundColor}" />
<SolidColorBrush x:Key="SplitButtonForegroundChecked" Color="{DynamicResource ThemeForegroundColor}" /> <SolidColorBrush x:Key="SplitButtonForegroundPointerOver" Color="{DynamicResource ThemeForegroundColor}" />
<SolidColorBrush x:Key="SplitButtonForegroundCheckedPointerOver" Color="{DynamicResource ThemeForegroundColor}" /> <SolidColorBrush x:Key="SplitButtonForegroundPressed" Color="{DynamicResource ThemeForegroundColor}" />
<SolidColorBrush x:Key="SplitButtonForegroundCheckedPressed" Color="{DynamicResource ThemeForegroundColor}" /> <SolidColorBrush x:Key="SplitButtonForegroundDisabled" Color="{DynamicResource ThemeForegroundColor}" />
<SolidColorBrush x:Key="SplitButtonForegroundCheckedDisabled" Color="{DynamicResource ThemeForegroundColor}" /> <SolidColorBrush x:Key="SplitButtonForegroundChecked" Color="{DynamicResource ThemeForegroundColor}" />
<SolidColorBrush x:Key="SplitButtonForegroundCheckedPointerOver" Color="{DynamicResource ThemeForegroundColor}" />
<SolidColorBrush x:Key="SplitButtonBorderBrush" Color="{DynamicResource ThemeBorderLowColor}" /> <SolidColorBrush x:Key="SplitButtonForegroundCheckedPressed" Color="{DynamicResource ThemeForegroundColor}" />
<SolidColorBrush x:Key="SplitButtonBorderBrushPointerOver" Color="{DynamicResource ThemeBorderMidColor}" /> <SolidColorBrush x:Key="SplitButtonForegroundCheckedDisabled" Color="{DynamicResource ThemeForegroundColor}" />
<SolidColorBrush x:Key="SplitButtonBorderBrushPressed" Color="{DynamicResource ThemeBorderLowColor}" />
<SolidColorBrush x:Key="SplitButtonBorderBrushDisabled" Color="{DynamicResource ThemeBorderLowColor}" /> <SolidColorBrush x:Key="SplitButtonBorderBrush" Color="{DynamicResource ThemeBorderLowColor}" />
<SolidColorBrush x:Key="SplitButtonBorderBrushChecked" Color="{DynamicResource ThemeBorderMidColor}" /> <SolidColorBrush x:Key="SplitButtonBorderBrushPointerOver" Color="{DynamicResource ThemeBorderMidColor}" />
<SolidColorBrush x:Key="SplitButtonBorderBrushCheckedPointerOver" Color="{DynamicResource ThemeBorderMidColor}" /> <SolidColorBrush x:Key="SplitButtonBorderBrushPressed" Color="{DynamicResource ThemeBorderLowColor}" />
<SolidColorBrush x:Key="SplitButtonBorderBrushCheckedPressed" Color="{DynamicResource ThemeControlHighColor}" /> <SolidColorBrush x:Key="SplitButtonBorderBrushDisabled" Color="{DynamicResource ThemeBorderLowColor}" />
<SolidColorBrush x:Key="SplitButtonBorderBrushCheckedDisabled" Color="{DynamicResource ThemeControlMidColor}" Opacity="{DynamicResource ThemeDisabledOpacity}" /> <SolidColorBrush x:Key="SplitButtonBorderBrushChecked" Color="{DynamicResource ThemeBorderMidColor}" />
</Styles.Resources> <SolidColorBrush x:Key="SplitButtonBorderBrushCheckedPointerOver" Color="{DynamicResource ThemeBorderMidColor}" />
<SolidColorBrush x:Key="SplitButtonBorderBrushCheckedPressed" Color="{DynamicResource ThemeControlHighColor}" />
<SolidColorBrush x:Key="SplitButtonBorderBrushCheckedDisabled" Color="{DynamicResource ThemeControlMidColor}"
Opacity="{DynamicResource ThemeDisabledOpacity}" />
<ControlTheme x:Key="DefaultSplitButtonComponent" TargetType="Button">
<Setter Property="Template">
<ControlTemplate>
<ContentPresenter x:Name="PART_ContentPresenter"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Padding="{TemplateBinding Padding}"
RecognizesAccessKey="True"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />
</ControlTemplate>
</Setter>
<Style Selector="SplitButton"> <Style Selector="^:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource SplitButtonBackgroundPointerOver}" />
<Setter Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushPointerOver}" />
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundPointerOver}" />
</Style>
<Style Selector="^:pressed /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource SplitButtonBackgroundPressed}" />
<Setter Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushPressed}" />
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundPressed}" />
</Style>
<Style Selector="^:disabled /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource SplitButtonBackgroundDisabled}" />
<Setter Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushDisabled}" />
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundDisabled}" />
</Style>
<Style Selector="^[Tag=flyout-open] /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource SplitButtonBackgroundPressed}" />
<Setter Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushPressed}" />
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundPressed}" />
</Style>
<Style Selector="^[Tag=checked]">
<Style Selector="^ /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource SplitButtonBackgroundChecked}" />
<Setter Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushChecked}" />
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundChecked}" />
</Style>
<Style Selector="^:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource SplitButtonBackgroundCheckedPointerOver}" />
<Setter Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushCheckedPointerOver}" />
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundCheckedPointerOver}" />
</Style>
<Style Selector="^:pressed /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource SplitButtonBackgroundCheckedPressed}" />
<Setter Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushCheckedPressed}" />
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundCheckedPressed}" />
</Style>
<Style Selector="^:disabled /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource SplitButtonBackgroundCheckedDisabled}" />
<Setter Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushCheckedDisabled}" />
<Setter Property="TextElement.Foreground" Value="{DynamicResource SplitButtonForegroundCheckedDisabled}" />
</Style>
</Style>
<Style Selector="^[Tag=checked-flyout-open] /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource SplitButtonBackgroundCheckedPressed}" />
<Setter Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushCheckedPressed}" />
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundCheckedPressed}" />
</Style>
</ControlTheme>
<ControlTheme x:Key="{x:Type SplitButton}" TargetType="SplitButton">
<Setter Property="Background" Value="{DynamicResource SplitButtonBackground}" /> <Setter Property="Background" Value="{DynamicResource SplitButtonBackground}" />
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForeground}" /> <Setter Property="Foreground" Value="{DynamicResource SplitButtonForeground}" />
<Setter Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrush}" /> <Setter Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrush}" />
@ -65,211 +142,82 @@
<Setter Property="VerticalAlignment" Value="Center" /> <Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" /> <Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Center" /> <Setter Property="VerticalContentAlignment" Value="Center" />
<!--<Setter Property="UseSystemFocusVisuals" Value="True" />
<Setter Property="FocusVisualMargin" Value="-3" />-->
<Setter Property="KeyboardNavigation.IsTabStop" Value="True" /> <Setter Property="KeyboardNavigation.IsTabStop" Value="True" />
<Setter Property="Focusable" Value="True" /> <Setter Property="Focusable" Value="True" />
<Setter Property="Padding" Value="4" /> <Setter Property="Padding" Value="4" />
<Setter Property="CornerRadius" Value="0" />
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <ControlTemplate>
<ControlTemplate> <Grid>
<Grid> <Grid.ColumnDefinitions>
<Grid.ColumnDefinitions> <ColumnDefinition Width="*" />
<ColumnDefinition Width="*" /> <ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions>
</Grid.ColumnDefinitions>
<Button x:Name="PART_PrimaryButton"
<Button x:Name="PART_PrimaryButton" Grid.Column="0"
Grid.Column="0" Theme="{StaticResource DefaultSplitButtonComponent}"
MinWidth="{DynamicResource SplitButtonPrimaryButtonSize}" MinWidth="{DynamicResource SplitButtonPrimaryButtonSize}"
Foreground="{TemplateBinding Foreground}" Foreground="{TemplateBinding Foreground}"
Background="{TemplateBinding Background}" Background="{TemplateBinding Background}"
BorderThickness="{TemplateBinding BorderThickness, Converter={StaticResource PrimaryButtonBorderMultiplier}}" BorderThickness="{TemplateBinding BorderThickness, Converter={StaticResource PrimaryButtonBorderMultiplier}}"
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
Content="{TemplateBinding Content}" Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplate="{TemplateBinding ContentTemplate}"
Command="{TemplateBinding Command}" Command="{TemplateBinding Command}"
CommandParameter="{TemplateBinding CommandParameter}" CommandParameter="{TemplateBinding CommandParameter}"
FontFamily="{TemplateBinding FontFamily}" CornerRadius="{TemplateBinding CornerRadius, Converter={StaticResource LeftCornerRadiusFilterConverter}}"
FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}"
FontWeight="{TemplateBinding FontWeight}" FontSize="{TemplateBinding FontSize}"
HorizontalAlignment="Stretch" FontWeight="{TemplateBinding FontWeight}"
VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="Stretch"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Focusable="False" Padding="{TemplateBinding Padding}"
KeyboardNavigation.IsTabStop="False" /> Focusable="False"
KeyboardNavigation.IsTabStop="False" />
<Border x:Name="SeparatorBorder"
Grid.Column="1" <Border x:Name="SeparatorBorder"
Background="Transparent" Grid.Column="1"
Width="{DynamicResource SplitButtonSeparatorWidth}" Background="Transparent"
BorderThickness="{TemplateBinding BorderThickness, Converter={StaticResource SeparatorBorderMultiplier}}" Width="{DynamicResource SplitButtonSeparatorWidth}"
BorderBrush="{TemplateBinding BorderBrush}" /> BorderThickness="{TemplateBinding BorderThickness, Converter={StaticResource SeparatorBorderMultiplier}}"
BorderBrush="{TemplateBinding BorderBrush}" />
<Button x:Name="PART_SecondaryButton"
Grid.Column="2" <Button x:Name="PART_SecondaryButton"
MinWidth="{DynamicResource SplitButtonSecondaryButtonSize}" Grid.Column="2"
BorderBrush="{TemplateBinding BorderBrush}" Theme="{StaticResource DefaultSplitButtonComponent}"
Foreground="{TemplateBinding Foreground}" MinWidth="{DynamicResource SplitButtonSecondaryButtonSize}"
Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness, Converter={StaticResource SecondaryButtonBorderMultiplier}}" Foreground="{TemplateBinding Foreground}"
Padding="0" Background="{TemplateBinding Background}"
HorizontalContentAlignment="Center" BorderThickness="{TemplateBinding BorderThickness, Converter={StaticResource SecondaryButtonBorderMultiplier}}"
VerticalContentAlignment="Center" CornerRadius="{TemplateBinding CornerRadius, Converter={StaticResource RightCornerRadiusFilterConverter}}"
HorizontalAlignment="Stretch" Padding="0"
VerticalAlignment="Stretch" HorizontalContentAlignment="Center"
Focusable="False" VerticalContentAlignment="Center"
KeyboardNavigation.IsTabStop="False" /> HorizontalAlignment="Stretch"
</Grid> VerticalAlignment="Stretch"
</ControlTemplate> Focusable="False"
</Setter.Value> KeyboardNavigation.IsTabStop="False">
<PathIcon Height="12" Width="12"
Data="M1939 486L2029 576L1024 1581L19 576L109 486L1024 1401L1939 486Z" />
</Button>
</Grid>
</ControlTemplate>
</Setter> </Setter>
</Style>
<!-- Default overridable styles -->
<Style Selector="SplitButton /template/ Button#PART_PrimaryButton">
<Setter Property="CornerRadius" Value="{TemplateBinding CornerRadius, Converter={StaticResource LeftCornerRadiusFilterConverter}}" />
</Style>
<Style Selector="SplitButton /template/ Button#PART_SecondaryButton">
<Setter Property="CornerRadius" Value="{TemplateBinding CornerRadius, Converter={StaticResource RightCornerRadiusFilterConverter}}" />
<Setter Property="Content">
<Template>
<PathIcon Height="12"
Width="12"
Data="M1939 486L2029 576L1024 1581L19 576L109 486L1024 1401L1939 486Z" />
</Template>
</Setter>
</Style>
<!-- Primary and Secondary buttons PointerOver State -->
<Style Selector="SplitButton /template/ Button#PART_PrimaryButton:pointerover /template/ ContentPresenter,
SplitButton /template/ Button#PART_SecondaryButton:pointerover /template/ ContentPresenter">
<Setter Property="Border.Background" Value="{DynamicResource SplitButtonBackgroundPointerOver}" />
<Setter Property="Border.BorderBrush" Value="{DynamicResource SplitButtonBorderBrushPointerOver}" />
<Setter Property="TextElement.Foreground" Value="{DynamicResource SplitButtonForegroundPointerOver}" />
</Style>
<Style Selector="SplitButton /template/ Button#PART_SecondaryButton:pointerover PathIcon">
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundPointerOver}" />
</Style>
<!-- Primary and Secondary buttons Pressed State -->
<Style Selector="SplitButton /template/ Button#PART_PrimaryButton:pressed /template/ ContentPresenter,
SplitButton /template/ Button#PART_SecondaryButton:pressed /template/ ContentPresenter">
<Setter Property="Border.Background" Value="{DynamicResource SplitButtonBackgroundPressed}" />
<Setter Property="Border.BorderBrush" Value="{DynamicResource SplitButtonBorderBrushPressed}" />
<Setter Property="TextElement.Foreground" Value="{DynamicResource SplitButtonForegroundPressed}" />
</Style>
<Style Selector="SplitButton /template/ Button#PART_SecondaryButton:pressed PathIcon">
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundPressed}" />
</Style>
<!-- SplitButton Pressed State -->
<Style Selector="SplitButton:pressed /template/ Button#PART_PrimaryButton /template/ ContentPresenter,
SplitButton:pressed /template/ Button#PART_SecondaryButton /template/ ContentPresenter,
SplitButton:pressed /template/ Border#SeparatorBorder">
<Setter Property="Border.Background" Value="{DynamicResource SplitButtonBackgroundPressed}" />
<Setter Property="Border.BorderBrush" Value="{DynamicResource SplitButtonBorderBrushPressed}" />
<Setter Property="TextElement.Foreground" Value="{DynamicResource SplitButtonForegroundPressed}" />
</Style>
<Style Selector="SplitButton:pressed /template/ Button#PART_SecondaryButton PathIcon">
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundPressed}" />
</Style>
<!-- Primary and Secondary buttons Flyout Open State -->
<Style Selector="SplitButton:flyout-open /template/ Button#PART_PrimaryButton /template/ ContentPresenter,
SplitButton:flyout-open /template/ Button#PART_SecondaryButton /template/ ContentPresenter,
SplitButton:flyout-open /template/ Border#SeparatorBorder">
<Setter Property="Border.Background" Value="{DynamicResource SplitButtonBackgroundPressed}" />
<Setter Property="Border.BorderBrush" Value="{DynamicResource SplitButtonBorderBrushPressed}" />
<Setter Property="TextElement.Foreground" Value="{DynamicResource SplitButtonForegroundPressed}" />
</Style>
<Style Selector="SplitButton:flyout-open /template/ Button#PART_SecondaryButton PathIcon">
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundPressed}" />
</Style>
<!-- Disabled State -->
<Style Selector="SplitButton:disabled /template/ Button#PART_PrimaryButton /template/ ContentPresenter,
SplitButton:disabled /template/ Button#PART_SecondaryButton /template/ ContentPresenter,
SplitButton:disabled /template/ Border#SeparatorBorder">
<Setter Property="Border.Background" Value="{DynamicResource SplitButtonBackgroundDisabled}" />
<Setter Property="Border.BorderBrush" Value="{DynamicResource SplitButtonBorderBrushDisabled}" />
<Setter Property="TextElement.Foreground" Value="{DynamicResource SplitButtonForegroundDisabled}" />
</Style>
<Style Selector="SplitButton:disabled /template/ Button#PART_SecondaryButton PathIcon">
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundDisabled}" />
</Style>
<!-- Checked State -->
<Style Selector="SplitButton:checked /template/ Button#PART_PrimaryButton /template/ ContentPresenter,
SplitButton:checked /template/ Button#PART_SecondaryButton /template/ ContentPresenter,
SplitButton:checked /template/ Border#SeparatorBorder">
<Setter Property="Border.Background" Value="{DynamicResource SplitButtonBackgroundChecked}" />
<Setter Property="Border.BorderBrush" Value="{DynamicResource SplitButtonBorderBrushChecked}" />
<Setter Property="TextElement.Foreground" Value="{DynamicResource SplitButtonForegroundChecked}" />
</Style>
<Style Selector="SplitButton:checked /template/ Button#PART_SecondaryButton PathIcon">
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundChecked}" />
</Style>
<!-- Checked PointerOver State -->
<Style Selector="SplitButton:checked /template/ Button#PART_PrimaryButton:pointerover /template/ ContentPresenter,
SplitButton:checked /template/ Button#PART_SecondaryButton:pointerover /template/ ContentPresenter">
<Setter Property="Border.Background" Value="{DynamicResource SplitButtonBackgroundCheckedPointerOver}" />
<Setter Property="Border.BorderBrush" Value="{DynamicResource SplitButtonBorderBrushCheckedPointerOver}" />
<Setter Property="TextElement.Foreground" Value="{DynamicResource SplitButtonForegroundCheckedPointerOver}" />
</Style>
<Style Selector="SplitButton:checked /template/ Button#PART_SecondaryButton:pointerover PathIcon">
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundCheckedPointerOver}" />
</Style>
<!-- Checked Pressed State -->
<Style Selector="SplitButton:checked /template/ Button#PART_PrimaryButton:pressed /template/ ContentPresenter,
SplitButton:checked /template/ Button#PART_SecondaryButton:pressed /template/ ContentPresenter">
<Setter Property="Border.Background" Value="{DynamicResource SplitButtonBackgroundCheckedPressed}" />
<Setter Property="Border.BorderBrush" Value="{DynamicResource SplitButtonBorderBrushCheckedPressed}" />
<Setter Property="TextElement.Foreground" Value="{DynamicResource SplitButtonForegroundCheckedPressed}" />
</Style>
<Style Selector="SplitButton:checked /template/ Button#PART_SecondaryButton:pressed PathIcon">
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundCheckedPressed}" />
</Style>
<!-- SplitButton Checked Pressed State --> <Style Selector="^:flyout-open /template/ Button">
<Style Selector="SplitButton:pressed:checked /template/ Button#PART_PrimaryButton /template/ ContentPresenter, <Setter Property="Tag" Value="flyout-open" />
SplitButton:pressed:checked /template/ Button#PART_SecondaryButton /template/ ContentPresenter, </Style>
SplitButton:pressed:checked /template/ Border#SeparatorBorder">
<Setter Property="Border.Background" Value="{DynamicResource SplitButtonBackgroundCheckedPressed}" />
<Setter Property="Border.BorderBrush" Value="{DynamicResource SplitButtonBorderBrushCheckedPressed}" />
<Setter Property="TextElement.Foreground" Value="{DynamicResource SplitButtonForegroundCheckedPressed}" />
</Style>
<Style Selector="SplitButton:pressed:checked /template/ Button#PART_SecondaryButton PathIcon">
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundCheckedPressed}" />
</Style>
<!-- Checked Flyout Open State --> <Style Selector="^:checked /template/ Button">
<Style Selector="SplitButton:checked:flyout-open /template/ Button#PART_PrimaryButton /template/ ContentPresenter, <Setter Property="Tag" Value="checked" />
SplitButton:checked:flyout-open /template/ Button#PART_SecondaryButton /template/ ContentPresenter, </Style>
SplitButton:checked:flyout-open /template/ Border#SeparatorBorder">
<Setter Property="Border.Background" Value="{DynamicResource SplitButtonBackgroundCheckedPressed}" />
<Setter Property="Border.BorderBrush" Value="{DynamicResource SplitButtonBorderBrushCheckedPressed}" />
<Setter Property="TextElement.Foreground" Value="{DynamicResource SplitButtonForegroundCheckedPressed}" />
</Style>
<Style Selector="SplitButton:checked:flyout-open /template/ Button#PART_SecondaryButton PathIcon">
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundCheckedPressed}" />
</Style>
<!-- Disabled Checked State --> <Style Selector="^:checked:flyout-open /template/ Button">
<Style Selector="SplitButton:checked:disabled /template/ Button#PART_PrimaryButton /template/ ContentPresenter, <Setter Property="Tag" Value="checked-flyout-open" />
SplitButton:checked:disabled /template/ Button#PART_SecondaryButton /template/ ContentPresenter, </Style>
SplitButton:checked:disabled /template/ Border#SeparatorBorder"> </ControlTheme>
<Setter Property="Border.Background" Value="{DynamicResource SplitButtonBackgroundCheckedDisabled}" /> </ResourceDictionary>
<Setter Property="Border.BorderBrush" Value="{DynamicResource SplitButtonBorderBrushCheckedDisabled}" />
<Setter Property="TextElement.Foreground" Value="{DynamicResource SplitButtonForegroundCheckedDisabled}" />
</Style>
<Style Selector="SplitButton:checked:disabled /template/ Button#PART_SecondaryButton PathIcon">
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundCheckedDisabled}" />
</Style>
</Styles>

451
src/Avalonia.Themes.Default/Controls/SplitView.xaml

@ -1,6 +1,6 @@
<Styles xmlns="https://github.com/avaloniaui" <ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="using:System"> xmlns:sys="using:System">
<Design.PreviewWith> <Design.PreviewWith>
<Border Width="400" Height="400"> <Border Width="400" Height="400">
<SplitView DisplayMode="Inline" <SplitView DisplayMode="Inline"
@ -15,220 +15,241 @@
</Border> </Border>
</Design.PreviewWith> </Design.PreviewWith>
<Styles.Resources> <x:Double x:Key="SplitViewOpenPaneThemeLength">320</x:Double>
<x:Double x:Key="SplitViewOpenPaneThemeLength">320</x:Double> <x:Double x:Key="SplitViewCompactPaneThemeLength">48</x:Double>
<x:Double x:Key="SplitViewCompactPaneThemeLength">48</x:Double> <SolidColorBrush x:Key="SplitViewLightDismissOverlayBackground" Color="{DynamicResource ThemeControlLowColor}"
<SolidColorBrush x:Key="SplitViewLightDismissOverlayBackground" Color="{DynamicResource ThemeControlLowColor}" Opacity="0.6"/> Opacity="0.6" />
<sys:TimeSpan x:Key="SplitViewPaneAnimationOpenDuration">00:00:00.2</sys:TimeSpan> <sys:TimeSpan x:Key="SplitViewPaneAnimationOpenDuration">00:00:00.2</sys:TimeSpan>
<sys:TimeSpan x:Key="SplitViewPaneAnimationCloseDuration">00:00:00.1</sys:TimeSpan> <sys:TimeSpan x:Key="SplitViewPaneAnimationCloseDuration">00:00:00.1</sys:TimeSpan>
<Easing x:Key="SplitViewPaneAnimationEasing">0.1,0.9,0.2,1.0</Easing> <Easing x:Key="SplitViewPaneAnimationEasing">0.1,0.9,0.2,1.0</Easing>
<!-- Not used here (directly), but preserving for reference <!-- Not used here (directly), but preserving for reference
<x:String x:Key="SplitViewPaneAnimationOpenPreDuration">00:00:00.19999</x:String>--> <x:String x:Key="SplitViewPaneAnimationOpenPreDuration">00:00:00.19999</x:String>-->
</Styles.Resources>
<Style Selector="SplitView"> <ControlTheme x:Key="{x:Type SplitView}"
TargetType="SplitView">
<Setter Property="OpenPaneLength" Value="{DynamicResource SplitViewOpenPaneThemeLength}" /> <Setter Property="OpenPaneLength" Value="{DynamicResource SplitViewOpenPaneThemeLength}" />
<Setter Property="CompactPaneLength" Value="{DynamicResource SplitViewCompactPaneThemeLength}" /> <Setter Property="CompactPaneLength" Value="{DynamicResource SplitViewCompactPaneThemeLength}" />
<Setter Property="PaneBackground" Value="{DynamicResource ThemeControlHighlightLowBrush}" /> <Setter Property="PaneBackground" Value="{DynamicResource ThemeControlHighlightLowBrush}" />
</Style>
<!-- Left -->
<!-- Left --> <Style Selector="^:left">
<Style Selector="SplitView:left"> <Setter Property="Template">
<Setter Property="Template"> <ControlTemplate x:CompileBindings="True"
<ControlTemplate> TargetType="SplitView">
<Grid Name="Container" Background="{TemplateBinding Background}"> <Grid Name="Container"
<Grid.ColumnDefinitions> Background="{TemplateBinding Background}">
<!-- why is this throwing a binding error? --> <Grid.ColumnDefinitions>
<ColumnDefinition Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.PaneColumnGridLength}"/> <ColumnDefinition
<ColumnDefinition Width="*"/> Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.PaneColumnGridLength}" />
</Grid.ColumnDefinitions> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Panel Name="PART_PaneRoot" Background="{TemplateBinding PaneBackground}"
ClipToBounds="True" <Panel Name="PART_PaneRoot" Background="{TemplateBinding PaneBackground}"
HorizontalAlignment="Left" ClipToBounds="True"
ZIndex="100"> HorizontalAlignment="Left"
<ContentPresenter x:Name="PART_PanePresenter" Content="{TemplateBinding Pane}" ContentTemplate="{TemplateBinding PaneTemplate}" /> ZIndex="100">
<Rectangle Name="HCPaneBorder" Fill="{DynamicResource SystemControlForegroundTransparentBrush}" Width="1" HorizontalAlignment="Right" /> <ContentPresenter x:Name="PART_PanePresenter" Content="{TemplateBinding Pane}"
</Panel> ContentTemplate="{TemplateBinding PaneTemplate}" />
<Rectangle Name="HCPaneBorder" Fill="Transparent" Width="1"
<Panel Name="ContentRoot"> HorizontalAlignment="Right" />
<ContentPresenter x:Name="PART_ContentPresenter" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" /> </Panel>
<Rectangle Name="LightDismissLayer"/>
</Panel> <Panel Name="ContentRoot">
<ContentPresenter x:Name="PART_ContentPresenter" Content="{TemplateBinding Content}"
</Grid> ContentTemplate="{TemplateBinding ContentTemplate}" />
</ControlTemplate> <Rectangle Name="LightDismissLayer" />
</Setter> </Panel>
</Style>
</Grid>
<!-- Overlay --> </ControlTemplate>
<Style Selector="SplitView:overlay:left /template/ Panel#PART_PaneRoot"> </Setter>
<Setter Property="Width" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" /> </Style>
<!-- ColumnSpan should be 2 -->
<Setter Property="Grid.ColumnSpan" Value="1"/> <!-- Overlay -->
<Setter Property="Grid.Column" Value="0"/> <Style Selector="^:overlay:left /template/ Panel#PART_PaneRoot">
</Style> <Setter Property="Width"
<Style Selector="SplitView:overlay:left /template/ Panel#ContentRoot"> Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" />
<Setter Property="Grid.Column" Value="1"/> <!-- ColumnSpan should be 2 -->
<Setter Property="Grid.ColumnSpan" Value="2"/> <Setter Property="Grid.ColumnSpan" Value="1" />
</Style> <Setter Property="Grid.Column" Value="0" />
</Style>
<!-- CompactInline --> <Style Selector="^:overlay:left /template/ Panel#ContentRoot">
<Style Selector="SplitView:compactinline:left /template/ Panel#PART_PaneRoot"> <Setter Property="Grid.Column" Value="1" />
<Setter Property="Grid.ColumnSpan" Value="1"/> <Setter Property="Grid.ColumnSpan" Value="2" />
<Setter Property="Grid.Column" Value="0"/> </Style>
<Setter Property="Width" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" />
</Style> <!-- CompactInline -->
<Style Selector="SplitView:compactinline:left /template/ Panel#ContentRoot"> <Style Selector="^:compactinline:left /template/ Panel#PART_PaneRoot">
<Setter Property="Grid.Column" Value="1"/> <Setter Property="Grid.ColumnSpan" Value="1" />
<Setter Property="Grid.ColumnSpan" Value="1"/> <Setter Property="Grid.Column" Value="0" />
</Style> <Setter Property="Width"
Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" />
<!-- CompactOverlay --> </Style>
<Style Selector="SplitView:compactoverlay:left /template/ Panel#PART_PaneRoot"> <Style Selector="^:compactinline:left /template/ Panel#ContentRoot">
<!-- ColumnSpan should be 2 --> <Setter Property="Grid.Column" Value="1" />
<Setter Property="Grid.ColumnSpan" Value="1"/> <Setter Property="Grid.ColumnSpan" Value="1" />
<Setter Property="Grid.Column" Value="0"/> </Style>
<Setter Property="Width" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" />
</Style> <!-- CompactOverlay -->
<Style Selector="SplitView:compactoverlay:left /template/ Panel#ContentRoot"> <Style Selector="^:compactoverlay:left /template/ Panel#PART_PaneRoot">
<Setter Property="Grid.Column" Value="1"/> <!-- ColumnSpan should be 2 -->
<Setter Property="Grid.ColumnSpan" Value="1"/> <Setter Property="Grid.ColumnSpan" Value="1" />
</Style> <Setter Property="Grid.Column" Value="0" />
<Setter Property="Width"
<!-- Inline --> Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" />
<Style Selector="SplitView:inline:left /template/ Panel#PART_PaneRoot"> </Style>
<Setter Property="Grid.ColumnSpan" Value="1"/> <Style Selector="^:compactoverlay:left /template/ Panel#ContentRoot">
<Setter Property="Grid.Column" Value="0"/> <Setter Property="Grid.Column" Value="1" />
<Setter Property="Width" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" /> <Setter Property="Grid.ColumnSpan" Value="1" />
</Style> </Style>
<Style Selector="SplitView:inline:left /template/ Panel#ContentRoot">
<Setter Property="Grid.Column" Value="1"/> <!-- Inline -->
<Setter Property="Grid.ColumnSpan" Value="1"/> <Style Selector="^:inline:left /template/ Panel#PART_PaneRoot">
</Style> <Setter Property="Grid.ColumnSpan" Value="1" />
<Setter Property="Grid.Column" Value="0" />
<!-- Right --> <Setter Property="Width"
<Style Selector="SplitView:right"> Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" />
<Setter Property="Template"> </Style>
<ControlTemplate> <Style Selector="^:inline:left /template/ Panel#ContentRoot">
<Grid Name="Container" Background="{TemplateBinding Background}"> <Setter Property="Grid.Column" Value="1" />
<Grid.ColumnDefinitions> <Setter Property="Grid.ColumnSpan" Value="1" />
<ColumnDefinition Width="*"/> </Style>
<ColumnDefinition Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.PaneColumnGridLength}"/>
</Grid.ColumnDefinitions> <!-- Right -->
<Style Selector="^:right">
<Panel Name="PART_PaneRoot" Background="{TemplateBinding PaneBackground}" <Setter Property="Template">
ClipToBounds="True" <ControlTemplate TargetType="SplitView"
HorizontalAlignment="Right" x:CompileBindings="True">
ZIndex="100"> <Grid Name="Container" Background="{TemplateBinding Background}">
<ContentPresenter x:Name="PART_PanePresenter" Content="{TemplateBinding Pane}" ContentTemplate="{TemplateBinding PaneTemplate}"/> <Grid.ColumnDefinitions>
<Rectangle Name="HCPaneBorder" <ColumnDefinition Width="*" />
Fill="{DynamicResource SystemControlForegroundTransparentBrush}" <ColumnDefinition
Width="1" HorizontalAlignment="Left" /> Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.PaneColumnGridLength}" />
</Panel> </Grid.ColumnDefinitions>
<Panel Name="ContentRoot"> <Panel Name="PART_PaneRoot" Background="{TemplateBinding PaneBackground}"
<ContentPresenter x:Name="PART_ContentPresenter" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" /> ClipToBounds="True"
<Rectangle Name="LightDismissLayer"/> HorizontalAlignment="Right"
</Panel> ZIndex="100">
<ContentPresenter x:Name="PART_PanePresenter" Content="{TemplateBinding Pane}"
</Grid> ContentTemplate="{TemplateBinding PaneTemplate}" />
</ControlTemplate> <Rectangle Name="HCPaneBorder"
</Setter> Fill="Transparent"
</Style> Width="1" HorizontalAlignment="Left" />
</Panel>
<!-- Overlay -->
<Style Selector="SplitView:overlay:right /template/ Panel#PART_PaneRoot"> <Panel Name="ContentRoot">
<Setter Property="Width" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" /> <ContentPresenter x:Name="PART_ContentPresenter" Content="{TemplateBinding Content}"
<Setter Property="Grid.ColumnSpan" Value="2"/> ContentTemplate="{TemplateBinding ContentTemplate}" />
<Setter Property="Grid.Column" Value="1"/> <Rectangle Name="LightDismissLayer" />
</Style> </Panel>
<Style Selector="SplitView:overlay:right /template/ Panel#ContentRoot">
<Setter Property="Grid.Column" Value="0"/> </Grid>
<Setter Property="Grid.ColumnSpan" Value="2"/> </ControlTemplate>
</Style> </Setter>
</Style>
<!-- CompactInline -->
<Style Selector="SplitView:compactinline:right /template/ Panel#PART_PaneRoot"> <!-- Overlay -->
<Setter Property="Grid.ColumnSpan" Value="1"/> <Style Selector="^:overlay:right /template/ Panel#PART_PaneRoot">
<Setter Property="Grid.Column" Value="1"/> <Setter Property="Width"
<Setter Property="Width" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" /> Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" />
</Style> <Setter Property="Grid.ColumnSpan" Value="2" />
<Style Selector="SplitView:compactinline:right /template/ Panel#ContentRoot"> <Setter Property="Grid.Column" Value="1" />
<Setter Property="Grid.Column" Value="0"/> </Style>
<Setter Property="Grid.ColumnSpan" Value="1"/> <Style Selector="^:overlay:right /template/ Panel#ContentRoot">
</Style> <Setter Property="Grid.Column" Value="0" />
<Setter Property="Grid.ColumnSpan" Value="2" />
<!-- CompactOverlay --> </Style>
<Style Selector="SplitView:compactoverlay:right /template/ Panel#PART_PaneRoot">
<Setter Property="Grid.ColumnSpan" Value="2"/> <!-- CompactInline -->
<Setter Property="Grid.Column" Value="1"/> <Style Selector="^:compactinline:right /template/ Panel#PART_PaneRoot">
<Setter Property="Width" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" /> <Setter Property="Grid.ColumnSpan" Value="1" />
</Style> <Setter Property="Grid.Column" Value="1" />
<Style Selector="SplitView:compactoverlay:right /template/ Panel#ContentRoot"> <Setter Property="Width"
<Setter Property="Grid.Column" Value="0"/> Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" />
<Setter Property="Grid.ColumnSpan" Value="1"/> </Style>
</Style> <Style Selector="^:compactinline:right /template/ Panel#ContentRoot">
<Setter Property="Grid.Column" Value="0" />
<!-- Inline --> <Setter Property="Grid.ColumnSpan" Value="1" />
<Style Selector="SplitView:inline:right /template/ Panel#PART_PaneRoot"> </Style>
<Setter Property="Grid.ColumnSpan" Value="1"/>
<Setter Property="Grid.Column" Value="1"/> <!-- CompactOverlay -->
<Setter Property="Width" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" /> <Style Selector="^:compactoverlay:right /template/ Panel#PART_PaneRoot">
</Style> <Setter Property="Grid.ColumnSpan" Value="2" />
<Style Selector="SplitView:inline:right /template/ Panel#ContentRoot"> <Setter Property="Grid.Column" Value="1" />
<Setter Property="Grid.Column" Value="0"/> <Setter Property="Width"
<Setter Property="Grid.ColumnSpan" Value="1"/> Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" />
</Style> </Style>
<Style Selector="^:compactoverlay:right /template/ Panel#ContentRoot">
<!-- Open/Close Pane animation --> <Setter Property="Grid.Column" Value="0" />
<Style Selector="SplitView:open /template/ Panel#PART_PaneRoot"> <Setter Property="Grid.ColumnSpan" Value="1" />
<Setter Property="Transitions"> </Style>
<Transitions>
<DoubleTransition Property="Width" Duration="{StaticResource SplitViewPaneAnimationOpenDuration}" Easing="{StaticResource SplitViewPaneAnimationEasing}" /> <!-- Inline -->
</Transitions> <Style Selector="^:inline:right /template/ Panel#PART_PaneRoot">
</Setter> <Setter Property="Grid.ColumnSpan" Value="1" />
<Setter Property="Width" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=OpenPaneLength}" /> <Setter Property="Grid.Column" Value="1" />
</Style> <Setter Property="Width"
<Style Selector="SplitView:open /template/ Rectangle#LightDismissLayer"> Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" />
<Setter Property="Transitions"> </Style>
<Transitions> <Style Selector="^:inline:right /template/ Panel#ContentRoot">
<DoubleTransition Property="Opacity" Duration="{StaticResource SplitViewPaneAnimationOpenDuration}" Easing="{StaticResource SplitViewPaneAnimationEasing}" /> <Setter Property="Grid.Column" Value="0" />
</Transitions> <Setter Property="Grid.ColumnSpan" Value="1" />
</Setter> </Style>
<Setter Property="Opacity" Value="1.0"/>
</Style> <!-- Open/Close Pane animation -->
<Style Selector="^:open /template/ Panel#PART_PaneRoot">
<Style Selector="SplitView:closed /template/ Panel#PART_PaneRoot"> <Setter Property="Transitions">
<Setter Property="Transitions"> <Transitions>
<Transitions> <DoubleTransition Property="Width" Duration="{StaticResource SplitViewPaneAnimationOpenDuration}"
<DoubleTransition Property="Width" Duration="{StaticResource SplitViewPaneAnimationCloseDuration}" Easing="{StaticResource SplitViewPaneAnimationEasing}" /> Easing="{StaticResource SplitViewPaneAnimationEasing}" />
</Transitions> </Transitions>
</Setter> </Setter>
<Setter Property="Width" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" /> <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=OpenPaneLength}" />
</Style> </Style>
<Style Selector="SplitView:closed /template/ Rectangle#LightDismissLayer"> <Style Selector="^:open /template/ Rectangle#LightDismissLayer">
<Setter Property="Transitions"> <Setter Property="Transitions">
<Transitions> <Transitions>
<DoubleTransition Property="Opacity" Duration="{StaticResource SplitViewPaneAnimationCloseDuration}" Easing="{StaticResource SplitViewPaneAnimationEasing}" /> <DoubleTransition Property="Opacity" Duration="{StaticResource SplitViewPaneAnimationOpenDuration}"
</Transitions> Easing="{StaticResource SplitViewPaneAnimationEasing}" />
</Setter> </Transitions>
<Setter Property="Opacity" Value="0.0"/> </Setter>
</Style> <Setter Property="Opacity" Value="1.0" />
</Style>
<Style Selector="SplitView /template/ Rectangle#LightDismissLayer">
<Setter Property="IsVisible" Value="False"/> <Style Selector="^:closed /template/ Panel#PART_PaneRoot">
<Setter Property="Fill" Value="Transparent" /> <Setter Property="Transitions">
</Style> <Transitions>
<Style Selector="SplitView:lightdismiss /template/ Rectangle#LightDismissLayer"> <DoubleTransition Property="Width" Duration="{StaticResource SplitViewPaneAnimationCloseDuration}"
<Setter Property="Fill" Value="{DynamicResource SplitViewLightDismissOverlayBackground}" /> Easing="{StaticResource SplitViewPaneAnimationEasing}" />
</Style> </Transitions>
</Setter>
<Style Selector="SplitView:overlay:open /template/ Rectangle#LightDismissLayer"> <Setter Property="Width"
<Setter Property="IsVisible" Value="True"/> Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" />
</Style> </Style>
<Style Selector="SplitView:compactoverlay:open /template/ Rectangle#LightDismissLayer"> <Style Selector="^:closed /template/ Rectangle#LightDismissLayer">
<Setter Property="IsVisible" Value="True"/> <Setter Property="Transitions">
</Style> <Transitions>
<DoubleTransition Property="Opacity" Duration="{StaticResource SplitViewPaneAnimationCloseDuration}"
</Styles> Easing="{StaticResource SplitViewPaneAnimationEasing}" />
</Transitions>
</Setter>
<Setter Property="Opacity" Value="0.0" />
</Style>
<Style Selector="^ /template/ Rectangle#LightDismissLayer">
<Setter Property="IsVisible" Value="False" />
<Setter Property="Fill" Value="Transparent" />
</Style>
<Style Selector="^:lightdismiss /template/ Rectangle#LightDismissLayer">
<Setter Property="Fill" Value="{DynamicResource SplitViewLightDismissOverlayBackground}" />
</Style>
<Style Selector="^:overlay:open /template/ Rectangle#LightDismissLayer">
<Setter Property="IsVisible" Value="True" />
</Style>
<Style Selector="^:compactoverlay:open /template/ Rectangle#LightDismissLayer">
<Setter Property="IsVisible" Value="True" />
</Style>
</ControlTheme>
</ResourceDictionary>

101
src/Avalonia.Themes.Default/Controls/TabControl.xaml

@ -1,62 +1,61 @@
<Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Style Selector="TabControl"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Setter Property="Template"> <ControlTheme x:Key="{x:Type TabControl}"
<ControlTemplate> TargetType="TabControl">
<Border <Setter Property="Padding" Value="8" />
BorderBrush="{TemplateBinding BorderBrush}" <Setter Property="Template">
BorderThickness="{TemplateBinding BorderThickness}" <ControlTemplate>
CornerRadius="{TemplateBinding CornerRadius}" <Border Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}"
VerticalAlignment="{TemplateBinding VerticalAlignment}"> Background="{TemplateBinding Background}"
<DockPanel> BorderBrush="{TemplateBinding BorderBrush}"
<ItemsPresenter BorderThickness="{TemplateBinding BorderThickness}"
Name="PART_ItemsPresenter" CornerRadius="{TemplateBinding CornerRadius}">
<DockPanel>
<ItemsPresenter Name="PART_ItemsPresenter"
ItemTemplate="{TemplateBinding ItemTemplate}"
Items="{TemplateBinding Items}" Items="{TemplateBinding Items}"
ItemsPanel="{TemplateBinding ItemsPanel}" ItemsPanel="{TemplateBinding ItemsPanel}" />
ItemTemplate="{TemplateBinding ItemTemplate}"> <ContentPresenter Name="PART_SelectedContentHost"
</ItemsPresenter> Margin="{TemplateBinding Padding}"
<ContentPresenter HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
Name="PART_SelectedContentHost" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Margin="{TemplateBinding Padding}" Content="{TemplateBinding SelectedContent}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" ContentTemplate="{TemplateBinding SelectedContentTemplate}" />
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" </DockPanel>
Content="{TemplateBinding SelectedContent}" </Border>
ContentTemplate="{TemplateBinding SelectedContentTemplate}"> </ControlTemplate>
</ContentPresenter> </Setter>
</DockPanel> <Style Selector="^[TabStripPlacement=Top]">
</Border> <Setter Property="Padding" Value="0 4 0 0" />
</ControlTemplate>
</Setter>
</Style> </Style>
<Style Selector="TabControl[TabStripPlacement=Top]"> <Style Selector="^[TabStripPlacement=Top] /template/ ItemsPresenter#PART_ItemsPresenter">
<Setter Property="Padding" Value="0 4 0 0"/> <Setter Property="DockPanel.Dock" Value="Top" />
</Style> </Style>
<Style Selector="TabControl[TabStripPlacement=Top] /template/ ItemsPresenter#PART_ItemsPresenter"> <Style Selector="^[TabStripPlacement=Bottom] /template/ ItemsPresenter#PART_ItemsPresenter">
<Setter Property="DockPanel.Dock" Value="Top"/> <Setter Property="DockPanel.Dock" Value="Bottom" />
</Style> </Style>
<Style Selector="TabControl[TabStripPlacement=Bottom] /template/ ItemsPresenter#PART_ItemsPresenter"> <Style Selector="^[TabStripPlacement=Bottom]">
<Setter Property="DockPanel.Dock" Value="Bottom"/> <Setter Property="Padding" Value="0 0 0 4" />
</Style> </Style>
<Style Selector="TabControl[TabStripPlacement=Bottom]"> <Style Selector="^[TabStripPlacement=Left] /template/ ItemsPresenter#PART_ItemsPresenter">
<Setter Property="Padding" Value="0 0 0 4"/> <Setter Property="DockPanel.Dock" Value="Left" />
</Style> </Style>
<Style Selector="TabControl[TabStripPlacement=Left] /template/ ItemsPresenter#PART_ItemsPresenter"> <Style Selector="^[TabStripPlacement=Left] /template/ ItemsPresenter#PART_ItemsPresenter > WrapPanel">
<Setter Property="DockPanel.Dock" Value="Left"/> <Setter Property="Orientation" Value="Vertical" />
</Style> </Style>
<Style Selector="TabControl[TabStripPlacement=Left] /template/ ItemsPresenter#PART_ItemsPresenter > WrapPanel"> <Style Selector="^[TabStripPlacement=Left]">
<Setter Property="Orientation" Value="Vertical"/> <Setter Property="Padding" Value="4 0 0 0" />
</Style> </Style>
<Style Selector="TabControl[TabStripPlacement=Left]"> <Style Selector="^[TabStripPlacement=Right] /template/ ItemsPresenter#PART_ItemsPresenter">
<Setter Property="Padding" Value="4 0 0 0"/> <Setter Property="DockPanel.Dock" Value="Right" />
</Style> </Style>
<Style Selector="TabControl[TabStripPlacement=Right] /template/ ItemsPresenter#PART_ItemsPresenter"> <Style Selector="^[TabStripPlacement=Right] /template/ ItemsPresenter#PART_ItemsPresenter > WrapPanel">
<Setter Property="DockPanel.Dock" Value="Right"/> <Setter Property="Orientation" Value="Vertical" />
</Style> </Style>
<Style Selector="TabControl[TabStripPlacement=Right] /template/ ItemsPresenter#PART_ItemsPresenter > WrapPanel"> <Style Selector="^[TabStripPlacement=Right]">
<Setter Property="Orientation" Value="Vertical"/> <Setter Property="Padding" Value="0 0 4 0" />
</Style> </Style>
<Style Selector="TabControl[TabStripPlacement=Right]"> </ControlTheme>
<Setter Property="Padding" Value="0 0 4 0"/> </ResourceDictionary>
</Style>
</Styles>

91
src/Avalonia.Themes.Default/Controls/TabItem.xaml

@ -1,45 +1,46 @@
<Styles xmlns="https://github.com/avaloniaui"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Style Selector="TabItem"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Setter Property="Background" Value="Transparent"/> <ControlTheme x:Key="{x:Type TabItem}"
<Setter Property="FontSize" Value="{DynamicResource FontSizeLarge}"/> TargetType="TabItem">
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundLowBrush}"/> <Setter Property="Background" Value="Transparent" />
<Setter Property="HorizontalContentAlignment" Value="Left"/> <Setter Property="FontSize" Value="{DynamicResource FontSizeLarge}" />
<Setter Property="Padding" Value="8"/> <Setter Property="Foreground" Value="{DynamicResource ThemeForegroundLowBrush}" />
<Setter Property="Template"> <Setter Property="HorizontalContentAlignment" Value="Left" />
<ControlTemplate> <Setter Property="Padding" Value="8" />
<ContentPresenter <Setter Property="Template">
Name="PART_ContentPresenter" <ControlTemplate>
Background="{TemplateBinding Background}" <ContentPresenter Name="PART_ContentPresenter"
BorderBrush="{TemplateBinding BorderBrush}" Padding="{TemplateBinding Padding}"
BorderThickness="{TemplateBinding BorderThickness}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
CornerRadius="{TemplateBinding CornerRadius}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
ContentTemplate="{TemplateBinding HeaderTemplate}" Background="{TemplateBinding Background}"
Content="{TemplateBinding Header}" BorderBrush="{TemplateBinding BorderBrush}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" BorderThickness="{TemplateBinding BorderThickness}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" Content="{TemplateBinding Header}"
Padding="{TemplateBinding Padding}"/> ContentTemplate="{TemplateBinding HeaderTemplate}"
</ControlTemplate> CornerRadius="{TemplateBinding CornerRadius}" />
</Setter> </ControlTemplate>
</Style> </Setter>
<Style Selector="TabItem:disabled"> <Style Selector="^:disabled /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}"/> <Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
</Style> </Style>
<Style Selector="TabItem:pointerover"> <Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ThemeControlHighlightMidBrush}"/> <Setter Property="Background" Value="{DynamicResource ThemeControlHighlightMidBrush}" />
</Style> </Style>
<Style Selector="TabItem:selected"> <Style Selector="^:selected /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush4}"/> <Setter Property="Background" Value="{DynamicResource ThemeAccentBrush4}" />
</Style> </Style>
<Style Selector="TabItem:selected:focus"> <Style Selector="^:selected:focus /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush3}"/> <Setter Property="Background" Value="{DynamicResource ThemeAccentBrush3}" />
</Style> </Style>
<Style Selector="TabItem:selected:pointerover"> <Style Selector="^:selected:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush3}"/> <Setter Property="Background" Value="{DynamicResource ThemeAccentBrush3}" />
</Style> </Style>
<Style Selector="TabItem:selected:focus:pointerover"> <Style Selector="^:selected:focus:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush2}"/> <Setter Property="Background" Value="{DynamicResource ThemeAccentBrush2}" />
</Style> </Style>
<Style Selector="TabItem[TabStripPlacement=Right]"> <Style Selector="^[TabStripPlacement=Right]">
<Setter Property="HorizontalContentAlignment" Value="Right"/> <Setter Property="HorizontalContentAlignment" Value="Right" />
</Style> </Style>
</Styles> </ControlTheme>
</ResourceDictionary>

17
src/Avalonia.Themes.Default/Controls/TabStrip.xaml

@ -1,11 +1,13 @@
<Styles xmlns="https://github.com/avaloniaui"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Style Selector="TabStrip"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ControlTheme x:Key="{x:Type TabStrip}"
TargetType="TabStrip">
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<ItemsPresenter Name="PART_ItemsPresenter" <ItemsPresenter Name="PART_ItemsPresenter"
ItemTemplate="{TemplateBinding ItemTemplate}"
Items="{TemplateBinding Items}" Items="{TemplateBinding Items}"
ItemsPanel="{TemplateBinding ItemsPanel}" ItemsPanel="{TemplateBinding ItemsPanel}" />
ItemTemplate="{TemplateBinding ItemTemplate}"/>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
<Setter Property="ItemsPanel"> <Setter Property="ItemsPanel">
@ -13,8 +15,5 @@
<WrapPanel /> <WrapPanel />
</ItemsPanelTemplate> </ItemsPanelTemplate>
</Setter> </Setter>
</Style> </ControlTheme>
<Style Selector="TabStrip > TabStripItem"> </ResourceDictionary>
<Setter Property="Margin" Value="16"/>
</Style>
</Styles>

33
src/Avalonia.Themes.Default/Controls/TabStripItem.xaml

@ -1,24 +1,27 @@
<Styles xmlns="https://github.com/avaloniaui"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Style Selector="TabStripItem"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Setter Property="Background" Value="Transparent"/> <ControlTheme x:Key="{x:Type TabStripItem}"
<Setter Property="FontSize" Value="{DynamicResource FontSizeLarge}"/> TargetType="TabStripItem">
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundLowBrush}"/> <Setter Property="Background" Value="Transparent" />
<Setter Property="Margin" Value="16" />
<Setter Property="FontSize" Value="{DynamicResource FontSizeLarge}" />
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundLowBrush}" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<ContentPresenter Name="PART_ContentPresenter" <ContentPresenter Name="PART_ContentPresenter"
Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Background="{TemplateBinding Background}" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding Content}" Content="{TemplateBinding Content}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" ContentTemplate="{TemplateBinding ContentTemplate}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" CornerRadius="{TemplateBinding CornerRadius}" />
Padding="{TemplateBinding Padding}"/>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style> <Style Selector="^:selected /template/ ContentPresenter#PART_ContentPresenter">
<Style Selector="TabStripItem:selected"> <Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" />
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}"/> </Style>
</Style> </ControlTheme>
</Styles> </ResourceDictionary>

338
src/Avalonia.Themes.Default/Controls/TextBox.xaml

@ -1,29 +1,101 @@
<Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Styles.Resources> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StreamGeometry x:Key="TextBoxClearButtonData">M 11.416016,10 20,1.4160156 18.583984,0 10,8.5839846 1.4160156,0 0,1.4160156 8.5839844,10 0,18.583985 1.4160156,20 10,11.416015 18.583984,20 20,18.583985 Z</StreamGeometry> <StreamGeometry x:Key="TextBoxClearButtonData">M 11.416016,10 20,1.4160156 18.583984,0 10,8.5839846 1.4160156,0 0,1.4160156 8.5839844,10 0,18.583985 1.4160156,20 10,11.416015 18.583984,20 20,18.583985 Z</StreamGeometry>
<StreamGeometry x:Key="PasswordBoxRevealButtonData">m10.051 7.0032c2.215 0 4.0105 1.7901 4.0105 3.9984s-1.7956 3.9984-4.0105 3.9984c-2.215 0-4.0105-1.7901-4.0105-3.9984s1.7956-3.9984 4.0105-3.9984zm0 1.4994c-1.3844 0-2.5066 1.1188-2.5066 2.499s1.1222 2.499 2.5066 2.499 2.5066-1.1188 2.5066-2.499-1.1222-2.499-2.5066-2.499zm0-5.0026c4.6257 0 8.6188 3.1487 9.7267 7.5613 0.10085 0.40165-0.14399 0.80877-0.54686 0.90931-0.40288 0.10054-0.81122-0.14355-0.91208-0.54521-0.94136-3.7492-4.3361-6.4261-8.2678-6.4261-3.9334 0-7.3292 2.6792-8.2689 6.4306-0.10063 0.40171-0.50884 0.64603-0.91177 0.54571s-0.648-0.5073-0.54737-0.90901c1.106-4.4152 5.1003-7.5667 9.728-7.5667z</StreamGeometry> <StreamGeometry x:Key="PasswordBoxRevealButtonData">m10.051 7.0032c2.215 0 4.0105 1.7901 4.0105 3.9984s-1.7956 3.9984-4.0105 3.9984c-2.215 0-4.0105-1.7901-4.0105-3.9984s1.7956-3.9984 4.0105-3.9984zm0 1.4994c-1.3844 0-2.5066 1.1188-2.5066 2.499s1.1222 2.499 2.5066 2.499 2.5066-1.1188 2.5066-2.499-1.1222-2.499-2.5066-2.499zm0-5.0026c4.6257 0 8.6188 3.1487 9.7267 7.5613 0.10085 0.40165-0.14399 0.80877-0.54686 0.90931-0.40288 0.10054-0.81122-0.14355-0.91208-0.54521-0.94136-3.7492-4.3361-6.4261-8.2678-6.4261-3.9334 0-7.3292 2.6792-8.2689 6.4306-0.10063 0.40171-0.50884 0.64603-0.91177 0.54571s-0.648-0.5073-0.54737-0.90901c1.106-4.4152 5.1003-7.5667 9.728-7.5667z</StreamGeometry>
<StreamGeometry x:Key="PasswordBoxHideButtonData">m0.21967 0.21965c-0.26627 0.26627-0.29047 0.68293-0.07262 0.97654l0.07262 0.08412 4.0346 4.0346c-1.922 1.3495-3.3585 3.365-3.9554 5.7495-0.10058 0.4018 0.14362 0.8091 0.54543 0.9097 0.40182 0.1005 0.80909-0.1436 0.90968-0.5455 0.52947-2.1151 1.8371-3.8891 3.5802-5.0341l1.8096 1.8098c-0.70751 0.7215-1.1438 1.71-1.1438 2.8003 0 2.2092 1.7909 4 4 4 1.0904 0 2.0788-0.4363 2.8004-1.1438l5.9193 5.9195c0.2929 0.2929 0.7677 0.2929 1.0606 0 0.2663-0.2662 0.2905-0.6829 0.0726-0.9765l-0.0726-0.0841-6.1135-6.1142 0.0012-0.0015-1.2001-1.1979-2.8699-2.8693 2e-3 -8e-4 -2.8812-2.8782 0.0012-0.0018-1.1333-1.1305-4.3064-4.3058c-0.29289-0.29289-0.76777-0.29289-1.0607 0zm7.9844 9.0458 3.5351 3.5351c-0.45 0.4358-1.0633 0.704-1.7392 0.704-1.3807 0-2.5-1.1193-2.5-2.5 0-0.6759 0.26824-1.2892 0.7041-1.7391zm1.7959-5.7655c-1.0003 0-1.9709 0.14807-2.8889 0.425l1.237 1.2362c0.5358-0.10587 1.0883-0.16119 1.6519-0.16119 3.9231 0 7.3099 2.6803 8.2471 6.4332 0.1004 0.4018 0.5075 0.6462 0.9094 0.5459 0.4019-0.1004 0.6463-0.5075 0.5459-0.9094-1.103-4.417-5.0869-7.5697-9.7024-7.5697zm0.1947 3.5093 3.8013 3.8007c-0.1018-2.0569-1.7488-3.7024-3.8013-3.8007z</StreamGeometry> <StreamGeometry x:Key="PasswordBoxHideButtonData">m0.21967 0.21965c-0.26627 0.26627-0.29047 0.68293-0.07262 0.97654l0.07262 0.08412 4.0346 4.0346c-1.922 1.3495-3.3585 3.365-3.9554 5.7495-0.10058 0.4018 0.14362 0.8091 0.54543 0.9097 0.40182 0.1005 0.80909-0.1436 0.90968-0.5455 0.52947-2.1151 1.8371-3.8891 3.5802-5.0341l1.8096 1.8098c-0.70751 0.7215-1.1438 1.71-1.1438 2.8003 0 2.2092 1.7909 4 4 4 1.0904 0 2.0788-0.4363 2.8004-1.1438l5.9193 5.9195c0.2929 0.2929 0.7677 0.2929 1.0606 0 0.2663-0.2662 0.2905-0.6829 0.0726-0.9765l-0.0726-0.0841-6.1135-6.1142 0.0012-0.0015-1.2001-1.1979-2.8699-2.8693 2e-3 -8e-4 -2.8812-2.8782 0.0012-0.0018-1.1333-1.1305-4.3064-4.3058c-0.29289-0.29289-0.76777-0.29289-1.0607 0zm7.9844 9.0458 3.5351 3.5351c-0.45 0.4358-1.0633 0.704-1.7392 0.704-1.3807 0-2.5-1.1193-2.5-2.5 0-0.6759 0.26824-1.2892 0.7041-1.7391zm1.7959-5.7655c-1.0003 0-1.9709 0.14807-2.8889 0.425l1.237 1.2362c0.5358-0.10587 1.0883-0.16119 1.6519-0.16119 3.9231 0 7.3099 2.6803 8.2471 6.4332 0.1004 0.4018 0.5075 0.6462 0.9094 0.5459 0.4019-0.1004 0.6463-0.5075 0.5459-0.9094-1.103-4.417-5.0869-7.5697-9.7024-7.5697zm0.1947 3.5093 3.8013 3.8007c-0.1018-2.0569-1.7488-3.7024-3.8013-3.8007z</StreamGeometry>
<MenuFlyout x:Key="DefaultTextBoxContextFlyout" Placement="Bottom"> <MenuFlyout x:Key="DefaultTextBoxContextFlyout" Placement="Bottom">
<MenuItem x:Name="TextBoxContextFlyoutCutItem" Header="Cut" Command="{Binding $parent[TextBox].Cut}" IsEnabled="{Binding $parent[TextBox].CanCut}" InputGesture="{x:Static TextBox.CutGesture}" /> <MenuItem x:Name="TextBoxContextFlyoutCutItem" Header="Cut" Command="{Binding $parent[TextBox].Cut}"
<MenuItem x:Name="TextBoxContextFlyoutCopyItem" Header="Copy" Command="{Binding $parent[TextBox].Copy}" IsEnabled="{Binding $parent[TextBox].CanCopy}" InputGesture="{x:Static TextBox.CopyGesture}"/> IsEnabled="{Binding $parent[TextBox].CanCut}" InputGesture="{x:Static TextBox.CutGesture}" />
<MenuItem x:Name="TextBoxContextFlyoutPasteItem" Header="Paste" Command="{Binding $parent[TextBox].Paste}" IsEnabled="{Binding $parent[TextBox].CanPaste}" InputGesture="{x:Static TextBox.PasteGesture}"/> <MenuItem x:Name="TextBoxContextFlyoutCopyItem" Header="Copy" Command="{Binding $parent[TextBox].Copy}"
</MenuFlyout> IsEnabled="{Binding $parent[TextBox].CanCopy}" InputGesture="{x:Static TextBox.CopyGesture}" />
<MenuItem x:Name="TextBoxContextFlyoutPasteItem" Header="Paste" Command="{Binding $parent[TextBox].Paste}"
IsEnabled="{Binding $parent[TextBox].CanPaste}" InputGesture="{x:Static TextBox.PasteGesture}" />
</MenuFlyout>
<ContextMenu x:Key="DefaultTextBoxContextMenu" x:Name="TextBoxContextMenu"> <ContextMenu x:Key="DefaultTextBoxContextMenu" x:Name="TextBoxContextMenu">
<MenuItem x:Name="TextBoxContextMenuCutItem" Header="Cut" Command="{Binding $parent[TextBox].Cut}" IsEnabled="{Binding $parent[TextBox].CanCut}" InputGesture="{x:Static TextBox.CutGesture}" /> <MenuItem x:Name="TextBoxContextMenuCutItem" Header="Cut" Command="{Binding $parent[TextBox].Cut}"
<MenuItem x:Name="TextBoxContextMenuCopyItem" Header="Copy" Command="{Binding $parent[TextBox].Copy}" IsEnabled="{Binding $parent[TextBox].CanCopy}" InputGesture="{x:Static TextBox.CopyGesture}"/> IsEnabled="{Binding $parent[TextBox].CanCut}" InputGesture="{x:Static TextBox.CutGesture}" />
<MenuItem x:Name="TextBoxContextMenuPasteItem" Header="Paste" Command="{Binding $parent[TextBox].Paste}" IsEnabled="{Binding $parent[TextBox].CanPaste}" InputGesture="{x:Static TextBox.PasteGesture}"/> <MenuItem x:Name="TextBoxContextMenuCopyItem" Header="Copy" Command="{Binding $parent[TextBox].Copy}"
</ContextMenu> IsEnabled="{Binding $parent[TextBox].CanCopy}" InputGesture="{x:Static TextBox.CopyGesture}" />
</Styles.Resources> <MenuItem x:Name="TextBoxContextMenuPasteItem" Header="Paste" Command="{Binding $parent[TextBox].Paste}"
<Style Selector="TextBox"> IsEnabled="{Binding $parent[TextBox].CanPaste}" InputGesture="{x:Static TextBox.PasteGesture}" />
</ContextMenu>
<ControlTheme x:Key="DefaultTextBoxClearButtonTheme"
BasedOn="{StaticResource {x:Type Button}}"
TargetType="Button">
<Setter Property="Cursor" Value="Arrow" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="PART_ButtonLayoutBorder"
Background="Transparent"
BorderThickness="{TemplateBinding BorderThickness}">
<Path x:Name="PART_GlyphElement"
Width="10"
Height="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="{StaticResource TextBoxClearButtonData}"
Fill="{DynamicResource ThemeForegroundColor}"
Stretch="Uniform" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</ControlTheme>
<ControlTheme x:Key="DefaultPasswordBoxRevealButtonTheme"
BasedOn="{StaticResource {x:Type Button}}"
TargetType="ToggleButton">
<Setter Property="Cursor" Value="Arrow" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border x:Name="PART_ButtonLayoutBorder"
Width="12"
Background="Transparent">
<Panel>
<Path x:Name="PART_GlyphElement_Reveal"
Width="12"
Height="8"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="{DynamicResource PasswordBoxRevealButtonData}"
Fill="{DynamicResource ThemeForegroundColor}"
Stretch="Uniform" />
<Path x:Name="PART_GlyphElement_Hide"
Width="12"
Height="12"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="{DynamicResource PasswordBoxHideButtonData}"
Fill="{DynamicResource ThemeForegroundColor}"
Stretch="Uniform" />
</Panel>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style Selector="^:unchecked /template/ Path#PART_GlyphElement_Hide">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="^:checked /template/ Path#PART_GlyphElement_Reveal">
<Setter Property="IsVisible" Value="False" />
</Style>
</ControlTheme>
<ControlTheme x:Key="{x:Type TextBox}"
TargetType="TextBox">
<Setter Property="CaretBrush" Value="{DynamicResource ThemeForegroundBrush}" /> <Setter Property="CaretBrush" Value="{DynamicResource ThemeForegroundBrush}" />
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}"/> <Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/> <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" />
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}"/> <Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}" />
<Setter Property="SelectionBrush" Value="{DynamicResource HighlightBrush}"/> <Setter Property="SelectionBrush" Value="{DynamicResource HighlightBrush}" />
<Setter Property="SelectionForegroundBrush" Value="{DynamicResource HighlightForegroundBrush}"/> <Setter Property="SelectionForegroundBrush" Value="{DynamicResource HighlightForegroundBrush}" />
<Setter Property="Padding" Value="4"/> <Setter Property="Padding" Value="4" />
<Setter Property="ContextFlyout" Value="{StaticResource DefaultTextBoxContextFlyout}" /> <Setter Property="ContextFlyout" Value="{StaticResource DefaultTextBoxContextFlyout}" />
<Setter Property="ScrollViewer.IsScrollChainingEnabled" Value="True" /> <Setter Property="ScrollViewer.IsScrollChainingEnabled" Value="True" />
<Setter Property="Template"> <Setter Property="Template">
@ -38,17 +110,17 @@
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"> VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<TextBlock Name="floatingWatermark" <TextBlock Name="floatingWatermark"
Foreground="{DynamicResource ThemeAccentBrush}" DockPanel.Dock="Top"
FontSize="{DynamicResource FontSizeSmall}" FontSize="{DynamicResource FontSizeSmall}"
Text="{TemplateBinding Watermark}" Foreground="{DynamicResource ThemeAccentBrush}"
DockPanel.Dock="Top"> Text="{TemplateBinding Watermark}">
<TextBlock.IsVisible> <TextBlock.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}"> <MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding RelativeSource="{RelativeSource TemplatedParent}" <Binding Path="UseFloatingWatermark"
Path="UseFloatingWatermark"/> RelativeSource="{RelativeSource TemplatedParent}" />
<Binding RelativeSource="{RelativeSource TemplatedParent}" <Binding Converter="{x:Static StringConverters.IsNotNullOrEmpty}"
Path="Text" Path="Text"
Converter="{x:Static StringConverters.IsNotNullOrEmpty}"/> RelativeSource="{RelativeSource TemplatedParent}" />
</MultiBinding> </MultiBinding>
</TextBlock.IsVisible> </TextBlock.IsVisible>
</TextBlock> </TextBlock>
@ -56,148 +128,94 @@
<DataValidationErrors> <DataValidationErrors>
<Grid ColumnDefinitions="Auto,*,Auto"> <Grid ColumnDefinitions="Auto,*,Auto">
<ContentPresenter Grid.Column="0" Grid.ColumnSpan="1" Content="{TemplateBinding InnerLeftContent}"/> <ContentPresenter Grid.Column="0"
<ScrollViewer Grid.Column="1" Grid.ColumnSpan="1" Grid.ColumnSpan="1"
Content="{TemplateBinding InnerLeftContent}" />
<ScrollViewer Grid.Column="1"
Grid.ColumnSpan="1"
AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}"
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}" HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}"
IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}" IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}"
AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}"> VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}">
<Panel> <Panel>
<TextBlock Name="watermark" <TextBlock Name="watermark"
Opacity="0.5" IsVisible="{TemplateBinding Text,
Text="{TemplateBinding Watermark}" Converter={x:Static StringConverters.IsNullOrEmpty}}"
TextAlignment="{TemplateBinding TextAlignment}" Opacity="0.5"
TextWrapping="{TemplateBinding TextWrapping}" Text="{TemplateBinding Watermark}"
IsVisible="{TemplateBinding Text, Converter={x:Static StringConverters.IsNullOrEmpty}}"/> TextAlignment="{TemplateBinding TextAlignment}"
TextWrapping="{TemplateBinding TextWrapping}" />
<TextPresenter Name="PART_TextPresenter" <TextPresenter Name="PART_TextPresenter"
Text="{TemplateBinding Text, Mode=TwoWay}" CaretBrush="{TemplateBinding CaretBrush}"
CaretIndex="{TemplateBinding CaretIndex}" CaretIndex="{TemplateBinding CaretIndex}"
SelectionStart="{TemplateBinding SelectionStart}" LineHeight="{TemplateBinding LineHeight}"
SelectionEnd="{TemplateBinding SelectionEnd}" PasswordChar="{TemplateBinding PasswordChar}"
TextAlignment="{TemplateBinding TextAlignment}" RevealPassword="{TemplateBinding RevealPassword}"
TextWrapping="{TemplateBinding TextWrapping}" SelectionBrush="{TemplateBinding SelectionBrush}"
LineHeight="{TemplateBinding LineHeight}" SelectionEnd="{TemplateBinding SelectionEnd}"
PasswordChar="{TemplateBinding PasswordChar}" SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}"
RevealPassword="{TemplateBinding RevealPassword}" SelectionStart="{TemplateBinding SelectionStart}"
SelectionBrush="{TemplateBinding SelectionBrush}" Text="{TemplateBinding Text,
SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}" Mode=TwoWay}"
CaretBrush="{TemplateBinding CaretBrush}" /> TextAlignment="{TemplateBinding TextAlignment}"
TextWrapping="{TemplateBinding TextWrapping}" />
</Panel> </Panel>
</ScrollViewer> </ScrollViewer>
<ContentPresenter Grid.Column="2" Grid.ColumnSpan="1" Content="{TemplateBinding InnerRightContent}"/> <ContentPresenter Grid.Column="2"
Grid.ColumnSpan="1"
Content="{TemplateBinding InnerRightContent}" />
</Grid> </Grid>
</DataValidationErrors> </DataValidationErrors>
</DockPanel> </DockPanel>
</Border> </Border>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style>
<Style Selector="TextBox:pointerover /template/ Border#border"> <Style Selector="^:pointerover /template/ Border#border">
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderHighBrush}"/> <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderHighBrush}" />
</Style> </Style>
<Style Selector="TextBox:focus /template/ Border#border"> <Style Selector="^:focus /template/ Border#border">
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderHighBrush}"/> <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderHighBrush}" />
</Style> </Style>
<Style Selector="TextBox:error /template/ Border#border"> <Style Selector="^:error /template/ Border#border">
<Setter Property="BorderBrush" Value="{DynamicResource ErrorBrush}"/> <Setter Property="BorderBrush" Value="{DynamicResource ErrorBrush}" />
</Style> </Style>
<Style Selector="TextBox /template/ DockPanel"> <Style Selector="^ /template/ DockPanel">
<Setter Property="Cursor" Value="IBeam" /> <Setter Property="Cursor" Value="IBeam" />
</Style> </Style>
<Style Selector="TextBox:disabled /template/ Border#border"> <Style Selector="^:disabled /template/ Border#border">
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" /> <Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
</Style> </Style>
<Style Selector="TextBox.clearButton[AcceptsReturn=False][IsReadOnly=False]:focus:not(TextBox:empty)"> <Style Selector="^.clearButton[AcceptsReturn=False][IsReadOnly=False]:focus:not(TextBox:empty)">
<Setter Property="InnerRightContent"> <Setter Property="InnerRightContent">
<Template> <Template>
<Button Classes="textBoxClearButton" <Button Command="{Binding $parent[TextBox].Clear}"
Command="{Binding $parent[TextBox].Clear}" /> Focusable="False"
</Template> Theme="{StaticResource DefaultTextBoxClearButtonTheme}" />
</Setter> </Template>
</Style> </Setter>
</Style>
<Style Selector="Button.textBoxClearButton">
<Setter Property="Cursor" Value="Arrow" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="PART_ButtonLayoutBorder"
BorderThickness="{TemplateBinding BorderThickness}"
Background="Transparent">
<Path x:Name="PART_GlyphElement"
Fill="{DynamicResource ThemeForegroundColor}"
Data="{StaticResource TextBoxClearButtonData}"
Height="10"
Width="10"
Stretch="Uniform"
VerticalAlignment="Center"
HorizontalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style Selector="TextBox.revealPasswordButton[AcceptsReturn=False][IsReadOnly=False]:not(TextBox:empty)">
<Setter Property="InnerRightContent">
<Template>
<Panel Margin="4,0">
<Panel.Styles>
<Style Selector="ToggleButton[IsChecked=True]">
<Setter Property="(ToolTip.Tip)" Value="Hide Password" />
</Style>
<Style Selector="ToggleButton[IsChecked=False]">
<Setter Property="(ToolTip.Tip)" Value="Show Password" />
</Style>
</Panel.Styles>
<ToggleButton Classes="passwordBoxRevealButton" Background="Transparent" IsChecked="{Binding $parent[TextBox].RevealPassword, Mode=TwoWay}" />
</Panel>
</Template>
</Setter>
</Style>
<Style Selector="ToggleButton.passwordBoxRevealButton">
<Setter Property="Cursor" Value="Arrow" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border x:Name="PART_ButtonLayoutBorder"
Background="Transparent"
Width="12">
<Panel>
<Path x:Name="PART_GlyphElement_Reveal"
Fill="{DynamicResource ThemeForegroundColor}"
Data="{DynamicResource PasswordBoxRevealButtonData}"
Height="8"
Width="12"
Stretch="Uniform"
VerticalAlignment="Center"
HorizontalAlignment="Center" />
<Path x:Name="PART_GlyphElement_Hide"
Fill="{DynamicResource ThemeForegroundColor}"
Data="{DynamicResource PasswordBoxHideButtonData}"
Height="12"
Width="12"
Stretch="Uniform"
VerticalAlignment="Center"
HorizontalAlignment="Center" />
</Panel>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style Selector="ToggleButton.passwordBoxRevealButton:not(ToggleButton:checked) /template/ Path#PART_GlyphElement_Hide">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="ToggleButton.passwordBoxRevealButton:checked /template/ Path#PART_GlyphElement_Reveal">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="Button.textBoxClearButton, ToggleButton.passwordBoxRevealButton"> <Style Selector="^.revealPasswordButton[AcceptsReturn=False][IsReadOnly=False]:not(TextBox:empty)">
<Setter Property="Focusable" Value="False" /> <Setter Property="InnerRightContent">
</Style> <Template>
</Styles> <Panel Margin="4,0">
<Panel.Styles>
<Style Selector="ToggleButton[IsChecked=True]">
<Setter Property="(ToolTip.Tip)" Value="Hide Password" />
</Style>
<Style Selector="ToggleButton[IsChecked=False]">
<Setter Property="(ToolTip.Tip)" Value="Show Password" />
</Style>
</Panel.Styles>
<ToggleButton Background="Transparent"
Focusable="False"
IsChecked="{Binding $parent[TextBox].RevealPassword, Mode=TwoWay}"
Theme="{StaticResource DefaultPasswordBoxRevealButtonTheme}" />
</Panel>
</Template>
</Setter>
</Style>
</ControlTheme>
</ResourceDictionary>

467
src/Avalonia.Themes.Default/Controls/TimePicker.xaml

@ -1,175 +1,204 @@
<!-- <!--
// (c) Copyright Microsoft Corporation. // (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL). // This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details. // Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved. // All other rights reserved.
--> -->
<Styles xmlns="https://github.com/avaloniaui" <ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=netstandard"> xmlns:sys="clr-namespace:System;assembly=netstandard"
<Styles.Resources> x:CompileBindings="True">
<x:Double x:Key="TimePickerFlyoutPresenterItemHeight">40</x:Double> <Design.PreviewWith>
<x:Double x:Key="TimePickerSpacerThemeWidth">1</x:Double> <Border Height="500"
<Thickness x:Key="TimePickerBorderThemeThickness">1</Thickness> Padding="20">
<Thickness x:Key="TimePickerTopHeaderMargin">0,0,0,4</Thickness> <StackPanel VerticalAlignment="Center"
<x:Double x:Key="TimePickerFlyoutPresenterHighlightHeight">40</x:Double> Spacing="20">
<x:Double x:Key="TimePickerFlyoutPresenterAcceptDismissHostGridHeight">41</x:Double> <TimePicker />
<x:Double x:Key="TimePickerThemeMinWidth">242</x:Double> <TimePicker CornerRadius="10" />
<x:Double x:Key="TimePickerThemeMaxWidth">456</x:Double> <TimePicker IsEnabled="False" />
<Thickness x:Key="TimePickerFlyoutPresenterItemPadding">0,3,0,6</Thickness> <TimePicker>
<Thickness x:Key="TimePickerHostPadding">0,3,0,6</Thickness> <DataValidationErrors.Error>
</Styles.Resources> <sys:Exception>
<x:Arguments>
<x:String>Error</x:String>
</x:Arguments>
</sys:Exception>
</DataValidationErrors.Error>
</TimePicker>
</StackPanel>
</Border>
</Design.PreviewWith>
<Style Selector="ListBoxItem.DateTimePickerItem.HourItem"> <x:Double x:Key="TimePickerFlyoutPresenterItemHeight">40</x:Double>
<Setter Property="Padding" Value="{DynamicResource TimePickerFlyoutPresenterItemPadding}" /> <x:Double x:Key="TimePickerSpacerThemeWidth">1</x:Double>
</Style> <Thickness x:Key="TimePickerBorderThemeThickness">1</Thickness>
<Style Selector="ListBoxItem.DateTimePickerItem.MinuteItem"> <Thickness x:Key="TimePickerTopHeaderMargin">0,0,0,4</Thickness>
<Setter Property="Padding" Value="{DynamicResource TimePickerFlyoutPresenterItemPadding}" /> <x:Double x:Key="TimePickerFlyoutPresenterHighlightHeight">40</x:Double>
</Style> <x:Double x:Key="TimePickerFlyoutPresenterAcceptDismissHostGridHeight">41</x:Double>
<Style Selector="ListBoxItem.DateTimePickerItem.TimePeriodItem"> <x:Double x:Key="TimePickerThemeMinWidth">242</x:Double>
<Setter Property="Padding" Value="{DynamicResource TimePickerFlyoutPresenterItemPadding}" /> <x:Double x:Key="TimePickerThemeMaxWidth">456</x:Double>
</Style> <Thickness x:Key="TimePickerFlyoutPresenterItemPadding">0,3,0,6</Thickness>
<Thickness x:Key="TimePickerHostPadding">0,3,0,6</Thickness>
<Style Selector="TimePicker"> <ControlTheme x:Key="DefaultTimePickerFlyoutButton"
TargetType="Button">
<Setter Property="RenderTransform" Value="none" />
<Setter Property="Template">
<ControlTemplate>
<ContentPresenter Name="PART_ContentPresenter"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Content="{TemplateBinding Content}"
CornerRadius="{TemplateBinding CornerRadius}"
Foreground="{TemplateBinding Foreground}" />
</ControlTemplate>
</Setter>
<Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="BorderBrush" Value="{DynamicResource ThemeControlHighBrush}" />
<Setter Property="TextElement.Foreground" Value="{DynamicResource ThemeForegroundBrush}" />
</Style>
<Style Selector="^:pressed /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background">
<SolidColorBrush Opacity="0.6"
Color="{DynamicResource ThemeControlMidHighColor}" />
</Setter>
<Setter Property="BorderBrush" Value="{DynamicResource ThemeControlLowBrush}" />
<Setter Property="TextElement.Foreground" Value="{DynamicResource ThemeForegroundBrush}" />
</Style>
<Style Selector="^:disabled /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
</Style>
</ControlTheme>
<ControlTheme x:Key="{x:Type TimePicker}"
TargetType="TimePicker">
<Setter Property="FontSize" Value="{DynamicResource FontSizeNormal}" /> <Setter Property="FontSize" Value="{DynamicResource FontSizeNormal}" />
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" /> <Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" />
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}"/> <Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource ThemeControlHighlightMidBrush}"/> <Setter Property="BorderBrush" Value="{DynamicResource ThemeControlHighlightMidBrush}" />
<Setter Property="BorderThickness" Value="{DynamicResource TimePickerBorderThemeThickness}"/> <Setter Property="BorderThickness" Value="{DynamicResource TimePickerBorderThemeThickness}" />
<Setter Property="HorizontalAlignment" Value="Left" /> <Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" /> <Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Grid Name="LayoutRoot" Margin="{TemplateBinding Padding}" RowDefinitions="Auto,*"> <DataValidationErrors>
<ContentPresenter x:Name="HeaderContentPresenter" <Grid Name="LayoutRoot"
Grid.Row="0" Margin="{TemplateBinding Padding}"
Content="{TemplateBinding Header}" RowDefinitions="Auto,*">
ContentTemplate="{TemplateBinding HeaderTemplate}" <ContentPresenter x:Name="HeaderContentPresenter"
Margin="{DynamicResource TimePickerTopHeaderMargin}" Grid.Row="0"
MaxWidth="{DynamicResource TimePickerThemeMaxWidth}" MaxWidth="{DynamicResource TimePickerThemeMaxWidth}"
TextElement.Foreground="{DynamicResource ThemeForegroundColor}" Margin="{DynamicResource TimePickerTopHeaderMargin}"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Top" /> VerticalAlignment="Top"
Content="{TemplateBinding Header}"
ContentTemplate="{TemplateBinding HeaderTemplate}"
Foreground="{DynamicResource ThemeForegroundColor}" />
<Button x:Name="FlyoutButton" <Button x:Name="FlyoutButton"
Grid.Row="1" Grid.Row="1"
Foreground="{TemplateBinding Foreground}" MinWidth="{DynamicResource TimePickerThemeMinWidth}"
Background="{TemplateBinding Background}" MaxWidth="{DynamicResource TimePickerThemeMaxWidth}"
BorderBrush="{TemplateBinding BorderBrush}" HorizontalAlignment="Stretch"
BorderThickness="{TemplateBinding BorderThickness}" VerticalAlignment="Top"
CornerRadius="{TemplateBinding CornerRadius}" Background="{TemplateBinding Background}"
IsEnabled="{TemplateBinding IsEnabled}" BorderBrush="{TemplateBinding BorderBrush}"
MinWidth="{DynamicResource TimePickerThemeMinWidth}" BorderThickness="{TemplateBinding BorderThickness}"
MaxWidth="{DynamicResource TimePickerThemeMaxWidth}" CornerRadius="{TemplateBinding CornerRadius}"
HorizontalAlignment="Stretch" Foreground="{TemplateBinding Foreground}"
HorizontalContentAlignment="Stretch" IsEnabled="{TemplateBinding IsEnabled}"
VerticalAlignment="Top" Theme="{StaticResource DefaultTimePickerFlyoutButton}">
VerticalContentAlignment="Stretch">
<Button.Template>
<ControlTemplate>
<ContentPresenter Name="ContentPresenter"
BorderBrush="{TemplateBinding BorderBrush}"
Background="{TemplateBinding Background}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
Content="{TemplateBinding Content}"
TextElement.Foreground="{TemplateBinding Foreground}"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch" />
</ControlTemplate>
</Button.Template>
<Grid Name="FlyoutButtonContentGrid"> <Grid Name="FlyoutButtonContentGrid">
<!--Ignore col defs here, set in code--> <!-- Ignore col defs here, set in code -->
<Border x:Name="FirstPickerHost" Grid.Column="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <Border x:Name="FirstPickerHost"
<TextBlock x:Name="HourTextBlock" Grid.Column="0"
HorizontalAlignment="Center" HorizontalAlignment="Stretch"
Padding="{DynamicResource TimePickerHostPadding}" VerticalAlignment="Stretch">
FontFamily="{TemplateBinding FontFamily}" <TextBlock x:Name="HourTextBlock"
FontWeight="{TemplateBinding FontWeight}" Padding="{DynamicResource TimePickerHostPadding}"
FontSize="{TemplateBinding FontSize}" /> HorizontalAlignment="Center"
</Border> FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}" />
</Border>
<Rectangle Name="FirstColumnDivider" <Rectangle Name="FirstColumnDivider"
Fill="{DynamicResource ThemeControlMidHighBrush}" Grid.Column="1"
HorizontalAlignment="Center" Width="{DynamicResource TimePickerSpacerThemeWidth}"
Width="{DynamicResource TimePickerSpacerThemeWidth}" HorizontalAlignment="Center"
Grid.Column="1" /> Fill="{DynamicResource TimePickerSpacerFill}" />
<Border x:Name="SecondPickerHost" Grid.Column="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <Border x:Name="SecondPickerHost"
<TextBlock x:Name="MinuteTextBlock" Grid.Column="2"
HorizontalAlignment="Center" HorizontalAlignment="Stretch"
Padding="{DynamicResource TimePickerHostPadding}" VerticalAlignment="Stretch">
FontFamily="{TemplateBinding FontFamily}" <TextBlock x:Name="MinuteTextBlock"
FontWeight="{TemplateBinding FontWeight}" Padding="{DynamicResource TimePickerHostPadding}"
FontSize="{TemplateBinding FontSize}"/> HorizontalAlignment="Center"
</Border> FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}" />
</Border>
<Rectangle Name="SecondColumnDivider" <Rectangle Name="SecondColumnDivider"
Fill="{DynamicResource ThemeControlMidHighBrush}" Grid.Column="3"
HorizontalAlignment="Center" Width="{DynamicResource TimePickerSpacerThemeWidth}"
Width="{DynamicResource TimePickerSpacerThemeWidth}" HorizontalAlignment="Center"
Grid.Column="3" /> Fill="{DynamicResource TimePickerSpacerFill}" />
<Border x:Name="ThirdPickerHost" Grid.Column="4" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <Border x:Name="ThirdPickerHost"
<TextBlock x:Name="PeriodTextBlock" Grid.Column="4"
HorizontalAlignment="Center" HorizontalAlignment="Stretch"
Padding="{DynamicResource TimePickerHostPadding}" VerticalAlignment="Stretch">
FontFamily="{TemplateBinding FontFamily}" <TextBlock x:Name="PeriodTextBlock"
FontWeight="{TemplateBinding FontWeight}" Padding="{DynamicResource TimePickerHostPadding}"
FontSize="{TemplateBinding FontSize}" /> HorizontalAlignment="Center"
</Border> FontFamily="{TemplateBinding FontFamily}"
</Grid> FontSize="{TemplateBinding FontSize}"
</Button> FontWeight="{TemplateBinding FontWeight}" />
</Border>
</Grid>
</Button>
<Popup Name="Popup" WindowManagerAddShadowHint="False" <Popup Name="Popup"
StaysOpen="False" PlacementTarget="{TemplateBinding}" IsLightDismissEnabled="True"
PlacementMode="Bottom"> PlacementMode="Bottom"
<TimePickerPresenter Name="PickerPresenter" /> PlacementTarget="{TemplateBinding}"
</Popup> WindowManagerAddShadowHint="False">
<TimePickerPresenter Name="PickerPresenter" />
</Popup>
</Grid> </Grid>
</DataValidationErrors>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style>
<Style Selector="TimePicker:disabled /template/ ContentPresenter#HeaderContentPresenter">
<Setter Property="TextElement.Foreground" Value="{DynamicResource ThemeForegroundBrush}"/>
</Style>
<Style Selector="TimePicker:disabled /template/ Rectangle">
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}"/>
</Style>
<Style Selector="TimePicker /template/ Button#FlyoutButton:pointerover /template/ ContentPresenter"> <Style Selector="^:disabled /template/ ContentPresenter#HeaderContentPresenter">
<!--<Setter Property="Background" Value="{DynamicResource TimePickerButtonBackgroundPointerOver}"/>--> <Setter Property="TextElement.Foreground" Value="{DynamicResource ThemeForegroundBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource ThemeControlHighBrush}"/> </Style>
<Setter Property="TextElement.Foreground" Value="{DynamicResource ThemeForegroundBrush}"/>
</Style>
<Style Selector="TimePicker /template/ Button:pressed /template/ ContentPresenter"> <Style Selector="^:disabled /template/ Rectangle">
<Setter Property="Background"> <Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
<SolidColorBrush Color="{DynamicResource ThemeControlMidHighColor}" Opacity="0.6" /> </Style>
</Setter>
<Setter Property="BorderBrush" Value="{DynamicResource ThemeControlLowBrush}"/>
<Setter Property="TextElement.Foreground" Value="{DynamicResource ThemeForegroundBrush}"/>
</Style>
<Style Selector="TimePicker /template/ Button:disabled /template/ ContentPresenter"> <Style Selector="^:hasnotime /template/ Button#FlyoutButton TextBlock">
<!--<Setter Property="Background" Value="{DynamicResource TimePickerButtonBackgroundDisabled}"/> <Setter Property="Foreground" Value="{DynamicResource ThemeForegroundLowBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource TimePickerButtonBorderBrushDisabled}"/> </Style>
<Setter Property="TextElement.Foreground" Value="{DynamicResource TimePickerButtonForegroundDisabled}"/>--> </ControlTheme>
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
</Style>
<Style Selector="TimePicker:hasnotime /template/ Button#FlyoutButton TextBlock"> <ControlTheme x:Key="{x:Type TimePickerPresenter}"
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundLowBrush}"/> TargetType="TimePickerPresenter">
</Style>
<Style Selector="TimePickerPresenter">
<Setter Property="Width" Value="242" /> <Setter Property="Width" Value="242" />
<Setter Property="MinWidth" Value="242" /> <Setter Property="MinWidth" Value="242" />
<Setter Property="MaxHeight" Value="398" /> <Setter Property="MaxHeight" Value="398" />
<Setter Property="FontWeight" Value="Normal" /> <Setter Property="FontWeight" Value="Normal" />
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" /> <Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" /> <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" />
@ -177,110 +206,124 @@
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Border Name="Background" <Border Name="Background"
MaxHeight="398"
Padding="{DynamicResource DateTimeFlyoutBorderPadding}"
Background="{TemplateBinding Background}" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}" CornerRadius="{TemplateBinding CornerRadius}">
Padding="{DynamicResource DateTimeFlyoutBorderPadding}" <Grid Name="ContentPanel"
MaxHeight="398"> RowDefinitions="*,Auto">
<Grid Name="ContentPanel" RowDefinitions="*,Auto">
<Grid Name="PickerContainer"> <Grid Name="PickerContainer">
<!--Ignore col defs here, set in code--> <!-- Ignore col defs here, set in code -->
<Panel Name="HourHost" Grid.Column="0"> <Panel Name="HourHost"
Grid.Column="0">
<ScrollViewer HorizontalScrollBarVisibility="Disabled" <ScrollViewer HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Hidden"> VerticalScrollBarVisibility="Hidden">
<DateTimePickerPanel Name="HourSelector" <DateTimePickerPanel Name="HourSelector"
PanelType="Hour" ItemHeight="{DynamicResource TimePickerFlyoutPresenterItemHeight}"
ShouldLoop="True" PanelType="Hour"
ItemHeight="{DynamicResource TimePickerFlyoutPresenterItemHeight}"/> ShouldLoop="True" />
</ScrollViewer> </ScrollViewer>
<RepeatButton Name="HourUpButton" <RepeatButton Name="HourUpButton"
Classes="DateTimeFlyoutButtonStyle UpButton"/> Theme="{StaticResource DefaultDateTimePickerUpButton}" />
<RepeatButton Name="HourDownButton" <RepeatButton Name="HourDownButton"
Classes="DateTimeFlyoutButtonStyle DownButton"/> Theme="{StaticResource DefaultDateTimePickerDownButton}" />
</Panel> </Panel>
<Panel Name="MinuteHost" Grid.Column="2"> <Panel Name="MinuteHost"
Grid.Column="2">
<ScrollViewer HorizontalScrollBarVisibility="Disabled" <ScrollViewer HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Hidden"> VerticalScrollBarVisibility="Hidden">
<DateTimePickerPanel Name="MinuteSelector" <DateTimePickerPanel Name="MinuteSelector"
PanelType="Minute" ItemHeight="{DynamicResource TimePickerFlyoutPresenterItemHeight}"
ShouldLoop="True" PanelType="Minute"
ItemHeight="{DynamicResource TimePickerFlyoutPresenterItemHeight}"/> ShouldLoop="True" />
</ScrollViewer> </ScrollViewer>
<RepeatButton Name="MinuteUpButton" <RepeatButton Name="MinuteUpButton"
Classes="DateTimeFlyoutButtonStyle UpButton"/> Theme="{StaticResource DefaultDateTimePickerUpButton}" />
<RepeatButton Name="MinuteDownButton" <RepeatButton Name="MinuteDownButton"
Classes="DateTimeFlyoutButtonStyle DownButton"/> Theme="{StaticResource DefaultDateTimePickerDownButton}" />
</Panel> </Panel>
<Panel Name="PeriodHost" Grid.Column="4"> <Panel Name="PeriodHost"
Grid.Column="4">
<ScrollViewer HorizontalScrollBarVisibility="Disabled" <ScrollViewer HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Hidden"> VerticalScrollBarVisibility="Hidden">
<DateTimePickerPanel Name="PeriodSelector" <DateTimePickerPanel Name="PeriodSelector"
PanelType="TimePeriod" ItemHeight="{DynamicResource TimePickerFlyoutPresenterItemHeight}"
ShouldLoop="False" PanelType="TimePeriod"
ItemHeight="{DynamicResource TimePickerFlyoutPresenterItemHeight}"/> ShouldLoop="False" />
</ScrollViewer> </ScrollViewer>
<RepeatButton Name="PeriodUpButton" <RepeatButton Name="PeriodUpButton"
Classes="DateTimeFlyoutButtonStyle UpButton"/> Theme="{StaticResource DefaultDateTimePickerUpButton}" />
<RepeatButton Name="PeriodDownButton" <RepeatButton Name="PeriodDownButton"
Classes="DateTimeFlyoutButtonStyle DownButton"/> Theme="{StaticResource DefaultDateTimePickerDownButton}" />
</Panel> </Panel>
<Rectangle x:Name="HighlightRect" ZIndex="-1" <Rectangle x:Name="HighlightRect"
Fill="{DynamicResource TimePickerFlyoutPresenterHighlightFill}" Grid.Column="0"
Grid.Column="0" Grid.ColumnSpan="5"
Grid.ColumnSpan="5" Height="{DynamicResource TimePickerFlyoutPresenterHighlightHeight}"
VerticalAlignment="Center" VerticalAlignment="Center"
Height="{DynamicResource TimePickerFlyoutPresenterHighlightHeight}" /> ZIndex="-1">
<Rectangle.Fill>
<SolidColorBrush Opacity="0.6"
Color="{DynamicResource ThemeAccentColor}" />
</Rectangle.Fill>
</Rectangle>
<Rectangle Name="FirstSpacer" <Rectangle Name="FirstSpacer"
Fill="{DynamicResource ThemeControlMidHighBrush}" Grid.Column="1"
HorizontalAlignment="Center" Width="{DynamicResource TimePickerSpacerThemeWidth}"
Width="{DynamicResource TimePickerSpacerThemeWidth}" HorizontalAlignment="Center"
Grid.Column="1" /> Fill="{DynamicResource ThemeControlMidHighBrush}" />
<Rectangle Name="SecondSpacer" <Rectangle Name="SecondSpacer"
Fill="{DynamicResource ThemeControlMidHighBrush}" Grid.Column="3"
HorizontalAlignment="Center" Width="{DynamicResource TimePickerSpacerThemeWidth}"
Width="{DynamicResource TimePickerSpacerThemeWidth}" HorizontalAlignment="Center"
Grid.Column="3" /> Fill="{DynamicResource ThemeControlMidHighBrush}" />
</Grid> </Grid>
<Grid Grid.Row="1" Height="{DynamicResource TimePickerFlyoutPresenterAcceptDismissHostGridHeight}" <Grid Name="AcceptDismissGrid"
Name="AcceptDismissHostGrid" ColumnDefinitions="*,*"> Grid.Row="1"
<Rectangle Height="{DynamicResource TimePickerSpacerThemeWidth}" ColumnDefinitions="*,*">
VerticalAlignment="Top" <Rectangle Grid.ColumnSpan="2"
Fill="{DynamicResource ThemeControlMidHighBrush}" Height="{DynamicResource TimePickerSpacerThemeWidth}"
Grid.ColumnSpan="2" /> VerticalAlignment="Top"
<Button Name="AcceptButton" Grid.Column="0" Classes="DateTimeFlyoutButtonStyle" Fill="{DynamicResource ThemeControlMidHighBrush}" />
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <Button Name="AcceptButton"
<Path Stroke="{Binding $parent[Button].Foreground}" StrokeLineCap="Round" Grid.Column="0"
StrokeThickness="0.75" Data="M0.5,8.5 5,13.5 15.5,3" /> Height="{DynamicResource TimePickerFlyoutPresenterAcceptDismissHostGridHeight}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Theme="{StaticResource DefaultDateTimePickerButton}">
<Path Data="M0.5,8.5 5,13.5 15.5,3"
Stroke="{Binding $parent[Button].Foreground}"
StrokeLineCap="Round"
StrokeThickness="0.75" />
</Button> </Button>
<Button Name="DismissButton" Grid.Column="1" Classes="DateTimeFlyoutButtonStyle" <Button Name="DismissButton"
FontSize="16" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> Grid.Column="1"
<Path Stroke="{Binding $parent[Button].Foreground}" StrokeLineCap="Round" Height="{DynamicResource TimePickerFlyoutPresenterAcceptDismissHostGridHeight}"
StrokeThickness="0.75" Data="M2,2 14,14 M2,14 14 2" /> HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
FontSize="16"
Theme="{StaticResource DefaultDateTimePickerButton}">
<Path Data="M2,2 14,14 M2,14 14 2"
Stroke="{Binding $parent[Button].Foreground}"
StrokeLineCap="Round"
StrokeThickness="0.75" />
</Button> </Button>
</Grid> </Grid>
</Grid> </Grid>
</Border> </Border>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style>
<Style Selector="TimePickerPresenter /template/ Panel RepeatButton">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="TimePickerPresenter /template/ Panel:pointerover RepeatButton"> <Style Selector="^ /template/ Panel">
<Setter Property="IsVisible" Value="True" /> <Style Selector="^:pointerover RepeatButton">
</Style> <Setter Property="IsVisible" Value="True" />
</Style>
</Styles> </Style>
</ControlTheme>
</ResourceDictionary>

80
src/Avalonia.Themes.Default/Controls/TitleBar.xaml

@ -1,53 +1,65 @@
<Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Design.PreviewWith> <Design.PreviewWith>
<Border> <Border>
<TitleBar Background="SkyBlue" Height="30" Width="300" Foreground="Black" /> <TitleBar Width="300"
Height="30"
Background="SkyBlue"
Foreground="Black" />
</Border> </Border>
</Design.PreviewWith> </Design.PreviewWith>
<Style Selector="TitleBar"> <ControlTheme x:Key="{x:Type TitleBar}"
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}"/> TargetType="TitleBar">
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" />
<Setter Property="VerticalAlignment" Value="Top" /> <Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="HorizontalAlignment" Value="Stretch" /> <Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="Background" Value="Transparent" /> <Setter Property="Background" Value="Transparent" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Panel HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="Stretch"> <Panel HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
<Panel x:Name="PART_MouseTracker" Height="1" VerticalAlignment="Top" /> VerticalAlignment="Stretch">
<Panel x:Name="PART_MouseTracker"
Height="1"
VerticalAlignment="Top" />
<Panel x:Name="PART_Container"> <Panel x:Name="PART_Container">
<Border x:Name="PART_Background" Background="{TemplateBinding Background}" /> <Border x:Name="PART_Background"
<CaptionButtons x:Name="PART_CaptionButtons" VerticalAlignment="Top" HorizontalAlignment="Right" Foreground="{TemplateBinding Foreground}" /> Background="{TemplateBinding Background}" />
<CaptionButtons x:Name="PART_CaptionButtons"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Foreground="{TemplateBinding Foreground}" />
</Panel> </Panel>
</Panel> </Panel>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style> <Style Selector="^:fullscreen">
<Setter Property="Background" Value="{DynamicResource ThemeAccentColor}" />
</Style>
<Style Selector="TitleBar:fullscreen"> <Style Selector="^ /template/ Border#PART_Background">
<Setter Property="Background" Value="{DynamicResource ThemeAccentColor}" /> <Setter Property="IsHitTestVisible" Value="False" />
</Style> </Style>
<Style Selector="TitleBar /template/ Border#PART_Background"> <Style Selector="^:fullscreen /template/ Border#PART_Background">
<Setter Property="IsHitTestVisible" Value="False" /> <Setter Property="IsHitTestVisible" Value="True" />
</Style> </Style>
<Style Selector="TitleBar:fullscreen /template/ Border#PART_Background"> <Style Selector="^:fullscreen /template/ Panel#PART_MouseTracker">
<Setter Property="IsHitTestVisible" Value="True" /> <Setter Property="Background" Value="Transparent" />
</Style> </Style>
<Style Selector="TitleBar:fullscreen /template/ Panel#PART_MouseTracker"> <Style Selector="^:fullscreen /template/ Panel#PART_Container">
<Setter Property="Background" Value="Transparent" /> <Setter Property="RenderTransform" Value="translateY(-30px)" />
</Style> <Setter Property="Transitions">
<Transitions>
<Style Selector="TitleBar:fullscreen /template/ Panel#PART_Container"> <TransformOperationsTransition Property="RenderTransform"
<Setter Property="RenderTransform" Value="translateY(-30px)" /> Duration="0:0:.25" />
<Setter Property="Transitions"> </Transitions>
<Transitions> </Setter>
<TransformOperationsTransition Property="RenderTransform" Duration="0:0:.25" /> </Style>
</Transitions>
</Setter>
</Style>
<Style Selector="TitleBar:fullscreen:pointerover /template/ Panel#PART_Container"> <Style Selector="^:fullscreen:pointerover /template/ Panel#PART_Container">
<Setter Property="RenderTransform" Value="none" /> <Setter Property="RenderTransform" Value="none" />
</Style> </Style>
</Styles> </ControlTheme>
</ResourceDictionary>

62
src/Avalonia.Themes.Default/Controls/ToggleButton.xaml

@ -1,40 +1,42 @@
<Styles xmlns="https://github.com/avaloniaui"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Style Selector="ToggleButton"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Setter Property="Background" Value="{DynamicResource ThemeControlMidBrush}"/> <ControlTheme x:Key="{x:Type ToggleButton}"
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderLowBrush}"/> TargetType="ToggleButton">
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}"/> <Setter Property="Background" Value="{DynamicResource ThemeControlMidBrush}" />
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}"/> <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderLowBrush}" />
<Setter Property="Padding" Value="4"/> <Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}" />
<Setter Property="HorizontalContentAlignment" Value="Center"/> <Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" />
<Setter Property="VerticalContentAlignment" Value="Center"/> <Setter Property="Padding" Value="4" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<ContentPresenter Name="PART_ContentPresenter" <ContentPresenter Name="PART_ContentPresenter"
Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Background="{TemplateBinding Background}" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding Content}" Content="{TemplateBinding Content}"
Padding="{TemplateBinding Padding}" ContentTemplate="{TemplateBinding ContentTemplate}"
CornerRadius="{TemplateBinding CornerRadius}"
RecognizesAccessKey="True" RecognizesAccessKey="True"
TextElement.Foreground="{TemplateBinding Foreground}" TextElement.Foreground="{TemplateBinding Foreground}" />
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style> <Style Selector="^:checked /template/ ContentPresenter#PART_ContentPresenter">
<Style Selector="ToggleButton:checked /template/ ContentPresenter"> <Setter Property="Background" Value="{DynamicResource ThemeControlHighBrush}" />
<Setter Property="Background" Value="{DynamicResource ThemeControlHighBrush}"/> <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/> </Style>
</Style> <Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Style Selector="ToggleButton:pointerover /template/ ContentPresenter"> <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/> </Style>
</Style> <Style Selector="^:pressed /template/ ContentPresenter#PART_ContentPresenter">
<Style Selector="ToggleButton:pressed /template/ ContentPresenter"> <Setter Property="Background" Value="{DynamicResource ThemeControlHighBrush}" />
<Setter Property="Background" Value="{DynamicResource ThemeControlHighBrush}"/> </Style>
</Style> <Style Selector="^:disabled">
<Style Selector="ToggleButton:disabled"> <Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}"/> </Style>
</Style> </ControlTheme>
</Styles> </ResourceDictionary>

483
src/Avalonia.Themes.Default/Controls/ToggleSwitch.xaml

@ -1,69 +1,28 @@
<Styles xmlns="https://github.com/avaloniaui" <ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
xmlns:sys="clr-namespace:System;assembly=netstandard">
<Styles.Resources>
<Thickness x:Key="ToggleSwitchTopHeaderMargin">0,0,0,6</Thickness>
<GridLength x:Key="ToggleSwitchPreContentMargin">6</GridLength>
<GridLength x:Key="ToggleSwitchPostContentMargin">6</GridLength>
<x:Double x:Key="ToggleSwitchThemeMinWidth">0</x:Double>
<Thickness x:Key="ToggleSwitchOnStrokeThickness">0</Thickness>
<Thickness x:Key="ToggleSwitchOuterBorderStrokeThickness">1</Thickness>
<SolidColorBrush x:Key="ToggleSwitchContentForeground" Color="{DynamicResource ThemeForegroundColor}" />
<SolidColorBrush x:Key="ToggleSwitchContentForegroundDisabled" Color="{DynamicResource ThemeForegroundLowColor}" />
<SolidColorBrush x:Key="ToggleSwitchHeaderForeground" Color="{DynamicResource ThemeForegroundColor}" />
<SolidColorBrush x:Key="ToggleSwitchHeaderForegroundDisabled" Color="{DynamicResource ThemeForegroundLowColor}" />
<SolidColorBrush x:Key="ToggleSwitchContainerBackground" Color="Transparent" />
<SolidColorBrush x:Key="ToggleSwitchContainerBackgroundPointerOver" Color="Transparent" />
<SolidColorBrush x:Key="ToggleSwitchContainerBackgroundPressed" Color="Transparent" />
<SolidColorBrush x:Key="ToggleSwitchContainerBackgroundDisabled" Color="Transparent" />
<SolidColorBrush x:Key="ToggleSwitchFillOff" Color="Transparent" />
<SolidColorBrush x:Key="ToggleSwitchFillOffPointerOver" Color="Transparent" />
<SolidColorBrush x:Key="ToggleSwitchFillOffPressed" Color="{DynamicResource ThemeControlMidHighColor}" />
<SolidColorBrush x:Key="ToggleSwitchFillOffDisabled" Color="Transparent" />
<SolidColorBrush x:Key="ToggleSwitchStrokeOff" Color="{DynamicResource ThemeBorderMidColor}" />
<SolidColorBrush x:Key="ToggleSwitchStrokeOffPointerOver" Color="{DynamicResource ThemeBorderHighColor}" />
<SolidColorBrush x:Key="ToggleSwitchStrokeOffPressed" Color="{DynamicResource ThemeBorderHighColor}" />
<SolidColorBrush x:Key="ToggleSwitchStrokeOffDisabled" Color="{DynamicResource ThemeForegroundLowColor}" />
<SolidColorBrush x:Key="ToggleSwitchFillOn" Color="{DynamicResource ThemeAccentColor}" />
<SolidColorBrush x:Key="ToggleSwitchFillOnPointerOver" Color="{DynamicResource ThemeAccentColor2}" />
<SolidColorBrush x:Key="ToggleSwitchFillOnPressed" Color="{DynamicResource ThemeAccentColor3}" />
<SolidColorBrush x:Key="ToggleSwitchFillOnDisabled" Color="{DynamicResource ThemeForegroundLowColor}" />
<SolidColorBrush x:Key="ToggleSwitchStrokeOn" Color="{DynamicResource ThemeAccentColor}" />
<SolidColorBrush x:Key="ToggleSwitchStrokeOnPointerOver" Color="{DynamicResource ThemeAccentColor2}" />
<SolidColorBrush x:Key="ToggleSwitchStrokeOnPressed" Color="{DynamicResource ThemeAccentColor3}" />
<SolidColorBrush x:Key="ToggleSwitchStrokeOnDisabled" Color="{DynamicResource ThemeForegroundLowColor}" />
<SolidColorBrush x:Key="ToggleSwitchKnobFillOff" Color="{DynamicResource ThemeBorderMidColor}" />
<SolidColorBrush x:Key="ToggleSwitchKnobFillOffPointerOver" Color="{DynamicResource ThemeBorderHighColor}" />
<SolidColorBrush x:Key="ToggleSwitchKnobFillOffPressed" Color="{DynamicResource ThemeBorderHighColor}" />
<SolidColorBrush x:Key="ToggleSwitchKnobFillOffDisabled" Color="{DynamicResource ThemeForegroundLowColor}" />
<SolidColorBrush x:Key="ToggleSwitchKnobFillOn" Color="{DynamicResource HighlightForegroundColor}" />
<SolidColorBrush x:Key="ToggleSwitchKnobFillOnPointerOver" Color="{DynamicResource HighlightForegroundColor}" />
<SolidColorBrush x:Key="ToggleSwitchKnobFillOnPressed" Color="{DynamicResource HighlightForegroundColor}" />
<SolidColorBrush x:Key="ToggleSwitchKnobFillOnDisabled" Color="{DynamicResource HighlightForegroundColor}" />
</Styles.Resources>
<Design.PreviewWith> <Design.PreviewWith>
<StackPanel Margin="20" Width="250" Spacing="24" > <StackPanel Margin="20" Width="250" Spacing="24">
<StackPanel Spacing="12" > <StackPanel Spacing="12">
<TextBlock <TextBlock
Text="Automatic updates" Text="Automatic updates"
Classes="h1"/> Classes="h1" />
<TextBlock <TextBlock
Text="Updates will be automaticly Downloaded and installed shile the computer is shutting down or restarting" Text="Updates will be automaticly Downloaded and installed shile the computer is shutting down or restarting"
TextWrapping="Wrap"/> TextWrapping="Wrap" />
<ToggleSwitch HorizontalContentAlignment="Left" <ToggleSwitch HorizontalContentAlignment="Left"
Content="Enable automatic Updates?" Content="Enable automatic Updates?"
OffContent="Uit" OffContent="Uit"
OnContent="Aan" OnContent="Aan"
VerticalAlignment="Bottom"/> VerticalAlignment="Bottom" />
</StackPanel> </StackPanel>
<StackPanel Spacing="12"> <StackPanel Spacing="12">
<TextBlock <TextBlock
Text="Previewer" Text="Previewer"
Classes="h1"/> Classes="h1" />
<TextBlock <TextBlock
Text="The previewer Shows a preview off your code, this could slow down your system" Text="The previewer Shows a preview off your code, this could slow down your system"
TextWrapping="Wrap"/> TextWrapping="Wrap" />
<ToggleSwitch <ToggleSwitch
Content="Previewer" Content="Previewer"
IsChecked="True" /> IsChecked="True" />
@ -71,29 +30,71 @@
</StackPanel> </StackPanel>
</Design.PreviewWith> </Design.PreviewWith>
<Style Selector="ToggleSwitch"> <Thickness x:Key="ToggleSwitchTopHeaderMargin">0,0,0,6</Thickness>
<GridLength x:Key="ToggleSwitchPreContentMargin">6</GridLength>
<GridLength x:Key="ToggleSwitchPostContentMargin">6</GridLength>
<x:Double x:Key="ToggleSwitchThemeMinWidth">0</x:Double>
<Thickness x:Key="ToggleSwitchOnStrokeThickness">0</Thickness>
<Thickness x:Key="ToggleSwitchOuterBorderStrokeThickness">1</Thickness>
<SolidColorBrush x:Key="ToggleSwitchContentForeground" Color="{DynamicResource ThemeForegroundColor}" />
<SolidColorBrush x:Key="ToggleSwitchContentForegroundDisabled" Color="{DynamicResource ThemeForegroundLowColor}" />
<SolidColorBrush x:Key="ToggleSwitchHeaderForeground" Color="{DynamicResource ThemeForegroundColor}" />
<SolidColorBrush x:Key="ToggleSwitchHeaderForegroundDisabled" Color="{DynamicResource ThemeForegroundLowColor}" />
<SolidColorBrush x:Key="ToggleSwitchContainerBackground" Color="Transparent" />
<SolidColorBrush x:Key="ToggleSwitchContainerBackgroundPointerOver" Color="Transparent" />
<SolidColorBrush x:Key="ToggleSwitchContainerBackgroundPressed" Color="Transparent" />
<SolidColorBrush x:Key="ToggleSwitchContainerBackgroundDisabled" Color="Transparent" />
<SolidColorBrush x:Key="ToggleSwitchFillOff" Color="Transparent" />
<SolidColorBrush x:Key="ToggleSwitchFillOffPointerOver" Color="Transparent" />
<SolidColorBrush x:Key="ToggleSwitchFillOffPressed" Color="{DynamicResource ThemeControlMidHighColor}" />
<SolidColorBrush x:Key="ToggleSwitchFillOffDisabled" Color="Transparent" />
<SolidColorBrush x:Key="ToggleSwitchStrokeOff" Color="{DynamicResource ThemeBorderMidColor}" />
<SolidColorBrush x:Key="ToggleSwitchStrokeOffPointerOver" Color="{DynamicResource ThemeBorderHighColor}" />
<SolidColorBrush x:Key="ToggleSwitchStrokeOffPressed" Color="{DynamicResource ThemeBorderHighColor}" />
<SolidColorBrush x:Key="ToggleSwitchStrokeOffDisabled" Color="{DynamicResource ThemeForegroundLowColor}" />
<SolidColorBrush x:Key="ToggleSwitchFillOn" Color="{DynamicResource ThemeAccentColor}" />
<SolidColorBrush x:Key="ToggleSwitchFillOnPointerOver" Color="{DynamicResource ThemeAccentColor2}" />
<SolidColorBrush x:Key="ToggleSwitchFillOnPressed" Color="{DynamicResource ThemeAccentColor3}" />
<SolidColorBrush x:Key="ToggleSwitchFillOnDisabled" Color="{DynamicResource ThemeForegroundLowColor}" />
<SolidColorBrush x:Key="ToggleSwitchStrokeOn" Color="{DynamicResource ThemeAccentColor}" />
<SolidColorBrush x:Key="ToggleSwitchStrokeOnPointerOver" Color="{DynamicResource ThemeAccentColor2}" />
<SolidColorBrush x:Key="ToggleSwitchStrokeOnPressed" Color="{DynamicResource ThemeAccentColor3}" />
<SolidColorBrush x:Key="ToggleSwitchStrokeOnDisabled" Color="{DynamicResource ThemeForegroundLowColor}" />
<SolidColorBrush x:Key="ToggleSwitchKnobFillOff" Color="{DynamicResource ThemeBorderMidColor}" />
<SolidColorBrush x:Key="ToggleSwitchKnobFillOffPointerOver" Color="{DynamicResource ThemeBorderHighColor}" />
<SolidColorBrush x:Key="ToggleSwitchKnobFillOffPressed" Color="{DynamicResource ThemeBorderHighColor}" />
<SolidColorBrush x:Key="ToggleSwitchKnobFillOffDisabled" Color="{DynamicResource ThemeForegroundLowColor}" />
<SolidColorBrush x:Key="ToggleSwitchKnobFillOn" Color="{DynamicResource HighlightForegroundColor}" />
<SolidColorBrush x:Key="ToggleSwitchKnobFillOnPointerOver" Color="{DynamicResource HighlightForegroundColor}" />
<SolidColorBrush x:Key="ToggleSwitchKnobFillOnPressed" Color="{DynamicResource HighlightForegroundColor}" />
<SolidColorBrush x:Key="ToggleSwitchKnobFillOnDisabled" Color="{DynamicResource HighlightForegroundColor}" />
<ControlTheme x:Key="{x:Type ToggleSwitch}"
TargetType="ToggleSwitch">
<Setter Property="Foreground" Value="{DynamicResource ToggleSwitchContentForeground}" /> <Setter Property="Foreground" Value="{DynamicResource ToggleSwitchContentForeground}" />
<Setter Property="HorizontalAlignment" Value="Left" /> <Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" /> <Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Left" /> <Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="VerticalContentAlignment" Value="Center" /> <Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" /> <Setter Property="FontSize" Value="{DynamicResource FontSizeNormal}" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Grid Background="{TemplateBinding Background}" <Grid Background="{TemplateBinding Background}"
RowDefinitions="Auto,*"> RowDefinitions="Auto,*">
<ContentPresenter x:Name="PART_ContentPresenter" <ContentPresenter x:Name="PART_ContentPresenter"
Grid.Row="0" Grid.Row="0"
Content="{TemplateBinding Content}" Margin="{DynamicResource ToggleSwitchTopHeaderMargin}"
ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}"
RecognizesAccessKey="True" ContentTemplate="{TemplateBinding ContentTemplate}"
VerticalAlignment="Top"/> RecognizesAccessKey="True"
VerticalAlignment="Top" />
<Grid Grid.Row="1" <Grid Grid.Row="1"
MinWidth="{StaticResource ToggleSwitchThemeMinWidth}" MinWidth="{StaticResource ToggleSwitchThemeMinWidth}"
HorizontalAlignment="Left" HorizontalAlignment="Left"
VerticalAlignment="Top"> VerticalAlignment="Top">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="{DynamicResource ToggleSwitchPreContentMargin}" /> <RowDefinition Height="{DynamicResource ToggleSwitchPreContentMargin}" />
@ -108,52 +109,64 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid x:Name="SwitchAreaGrid" <Grid x:Name="SwitchAreaGrid"
Grid.RowSpan="3" Grid.RowSpan="3"
Grid.ColumnSpan="3" Grid.ColumnSpan="3"
TemplatedControl.IsTemplateFocusTarget="True" Background="{DynamicResource ToggleSwitchContainerBackground}"
Margin="0,5" /> TemplatedControl.IsTemplateFocusTarget="True"
Margin="0,5" />
<ContentPresenter x:Name="PART_OffContentPresenter" <ContentPresenter x:Name="PART_OffContentPresenter"
Grid.RowSpan="3" Grid.RowSpan="3"
Grid.Column="2" Grid.Column="2"
Content="{TemplateBinding OffContent}" Content="{TemplateBinding OffContent}"
ContentTemplate="{TemplateBinding OffContentTemplate}" ContentTemplate="{TemplateBinding OffContentTemplate}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
<ContentPresenter x:Name="PART_OnContentPresenter" <ContentPresenter x:Name="PART_OnContentPresenter"
Grid.RowSpan="3" Grid.RowSpan="3"
Grid.Column="2" Grid.Column="2"
Content="{TemplateBinding OnContent}" Content="{TemplateBinding OnContent}"
ContentTemplate="{TemplateBinding OnContentTemplate}" ContentTemplate="{TemplateBinding OnContentTemplate}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
<Border x:Name="OuterBorder" <Border x:Name="OuterBorder"
Grid.Row="1" Grid.Row="1"
Height="20" Height="20"
Width="40" Width="40"
CornerRadius="10" CornerRadius="10"
BorderThickness="{DynamicResource ToggleSwitchOuterBorderStrokeThickness}" /> Background="{DynamicResource ToggleSwitchFillOff}"
BorderBrush="{DynamicResource ToggleSwitchStrokeOff}"
BorderThickness="{DynamicResource ToggleSwitchOuterBorderStrokeThickness}" />
<Border x:Name="SwitchKnobBounds" <Border x:Name="SwitchKnobBounds"
Grid.Row="1" Grid.Row="1"
Height="20" Height="20"
Width="40" Width="40"
CornerRadius="10" CornerRadius="10"
BorderThickness="{DynamicResource ToggleSwitchOnStrokeThickness}"/> Background="{DynamicResource ToggleSwitchFillOn}"
BorderBrush="{DynamicResource ToggleSwitchStrokeOn}"
BorderThickness="{DynamicResource ToggleSwitchOnStrokeThickness}" />
<Canvas x:Name="SwitchKnob" Grid.Row="1" <Canvas x:Name="SwitchKnob" Grid.Row="1"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Width="20" Height="20"> Width="20" Height="20">
<Grid x:Name="MovingKnobs" <Grid x:Name="MovingKnobs"
Width="20" Height="20"> Width="20" Height="20">
<Grid.Transitions>
<Transitions>
<DoubleTransition Property="Canvas.Left" Duration="0:0:0.2" Easing="CubicEaseOut" />
</Transitions>
</Grid.Transitions>
<Ellipse x:Name="SwitchKnobOn" <Ellipse x:Name="SwitchKnobOn"
Fill="{DynamicResource ToggleSwitchKnobFillOn}"
Width="10" Height="10" /> Width="10" Height="10" />
<Ellipse x:Name="SwitchKnobOff" <Ellipse x:Name="SwitchKnobOff"
Fill="{DynamicResource ToggleSwitchKnobFillOff}"
Width="10" Height="10" /> Width="10" Height="10" />
</Grid> </Grid>
</Canvas> </Canvas>
@ -161,162 +174,128 @@
</Grid> </Grid>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style>
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter:empty">
<Style Selector="ToggleSwitch /template/ ContentPresenter#PART_ContentPresenter"> <Setter Property="Margin" Value="0" />
<Setter Property="Margin" Value="{DynamicResource ToggleSwitchTopHeaderMargin}" /> </Style>
</Style>
<Style Selector="ToggleSwitch /template/ ContentPresenter#PART_ContentPresenter:empty"> <!-- PointerOverState -->
<Setter Property="Margin" Value="0" /> <Style Selector="^:pointerover /template/ Border#OuterBorder">
</Style> <Setter Property="BorderBrush" Value="{DynamicResource ToggleSwitchStrokeOffPointerOver}" />
<Setter Property="Background" Value="{DynamicResource ToggleSwitchFillOffPointerOver}" />
<!-- NormalState --> </Style>
<Style Selector="ToggleSwitch /template/ Grid#SwitchAreaGrid">
<Setter Property="Background" Value="{DynamicResource ToggleSwitchContainerBackground}"/> <Style Selector="^:pointerover /template/ Ellipse#SwitchKnobOff">
</Style> <Setter Property="Fill" Value="{DynamicResource ToggleSwitchKnobFillOffPointerOver}" />
</Style>
<Style Selector="ToggleSwitch /template/ Border#OuterBorder">
<Setter Property="Background" Value="{DynamicResource ToggleSwitchFillOff}"/> <Style Selector="^:pointerover /template/ Ellipse#SwitchKnobOn">
<Setter Property="BorderBrush" Value="{DynamicResource ToggleSwitchStrokeOff}"/> <Setter Property="Fill" Value="{DynamicResource ToggleSwitchKnobFillOnPointerOver}" />
</Style> </Style>
<Style Selector="ToggleSwitch /template/ Border#SwitchKnobBounds"> <Style Selector="^:pointerover /template/ Border#SwitchKnobBounds">
<Setter Property="Background" Value="{DynamicResource ToggleSwitchFillOn}"/> <Setter Property="Background" Value="{DynamicResource ToggleSwitchFillOnPointerOver}" />
<Setter Property="BorderBrush" Value="{DynamicResource ToggleSwitchStrokeOn}"/> <Setter Property="BorderBrush" Value="{DynamicResource ToggleSwitchStrokeOnPointerOver}" />
</Style> </Style>
<Style Selector="ToggleSwitch /template/ Ellipse#SwitchKnobOn"> <Style Selector="^:pointerover /template/ Grid#SwitchAreaGrid">
<Setter Property="Fill" Value="{DynamicResource ToggleSwitchKnobFillOn}"/> <Setter Property="Background" Value="{DynamicResource ToggleSwitchContainerBackgroundPointerOver}" />
</Style> </Style>
<Style Selector="ToggleSwitch /template/ Ellipse#SwitchKnobOff"> <!-- PressedState -->
<Setter Property="Fill" Value="{DynamicResource ToggleSwitchKnobFillOff}"/> <Style Selector="^:pressed /template/ Border#OuterBorder">
</Style> <Setter Property="BorderBrush" Value="{DynamicResource ToggleSwitchStrokeOffPressed}" />
<Setter Property="Background" Value="{DynamicResource ToggleSwitchFillOffPressed}" />
<Style Selector="ToggleSwitch /template/ Grid#MovingKnobs"> </Style>
<Setter Property="Transitions">
<Transitions> <Style Selector="^:pressed /template/ Border#SwitchKnobBounds">
<DoubleTransition Property="Canvas.Left" Duration="0:0:0.2" Easing="CubicEaseOut"/> <Setter Property="Background" Value="{DynamicResource ToggleSwitchFillOnPressed}" />
</Transitions> <Setter Property="BorderBrush" Value="{DynamicResource ToggleSwitchStrokeOnPressed}" />
</Setter> </Style>
</Style>
<Style Selector="^:pressed /template/ Ellipse#SwitchKnobOff">
<!-- PointerOverState --> <Setter Property="Fill" Value="{DynamicResource ToggleSwitchKnobFillOffPressed}" />
<Style Selector="ToggleSwitch:pointerover /template/ Border#OuterBorder"> </Style>
<Setter Property="BorderBrush" Value="{DynamicResource ToggleSwitchStrokeOffPointerOver}"/>
<Setter Property="Background" Value="{DynamicResource ToggleSwitchFillOffPointerOver}"/> <Style Selector="^:pressed /template/ Ellipse#SwitchKnobOn">
</Style> <Setter Property="Fill" Value="{DynamicResource ToggleSwitchKnobFillOnPressed}" />
</Style>
<Style Selector="ToggleSwitch:pointerover /template/ Ellipse#SwitchKnobOff">
<Setter Property="Fill" Value="{DynamicResource ToggleSwitchKnobFillOffPointerOver}"/> <Style Selector="^:pressed /template/ Grid#SwitchAreaGrid">
</Style> <Setter Property="Background" Value="{DynamicResource ToggleSwitchContainerBackgroundPressed}" />
</Style>
<Style Selector="ToggleSwitch:pointerover /template/ Ellipse#SwitchKnobOn">
<Setter Property="Fill" Value="{DynamicResource ToggleSwitchKnobFillOnPointerOver}"/> <!-- DisabledState -->
</Style> <Style Selector="^:disabled">
<Setter Property="Foreground" Value="{DynamicResource ToggleSwitchHeaderForegroundDisabled}" />
<Style Selector="ToggleSwitch:pointerover /template/ Border#SwitchKnobBounds"> </Style>
<Setter Property="Background" Value="{DynamicResource ToggleSwitchFillOnPointerOver}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ToggleSwitchStrokeOnPointerOver}"/> <Style Selector="^:disabled /template/ Border#OuterBorder">
</Style> <Setter Property="BorderBrush" Value="{DynamicResource ToggleSwitchStrokeOffDisabled}" />
<Setter Property="Background" Value="{DynamicResource ToggleSwitchFillOffDisabled}" />
<Style Selector="ToggleSwitch:pointerover /template/ Grid#SwitchAreaGrid"> </Style>
<Setter Property="Background" Value="{DynamicResource ToggleSwitchContainerBackgroundPointerOver}"/>
</Style> <Style Selector="^:disabled /template/ Ellipse#SwitchKnobOff">
<Setter Property="Fill" Value="{DynamicResource ToggleSwitchKnobFillOffDisabled}" />
<!-- PressedState --> </Style>
<Style Selector="ToggleSwitch:pressed /template/ Border#OuterBorder">
<Setter Property="BorderBrush" Value="{DynamicResource ToggleSwitchStrokeOffPressed}"/> <Style Selector="^:disabled /template/ Ellipse#SwitchKnobOn">
<Setter Property="Background" Value="{DynamicResource ToggleSwitchFillOffPressed}"/> <Setter Property="Fill" Value="{DynamicResource ToggleSwitchKnobFillOnDisabled}" />
</Style> </Style>
<Style Selector="ToggleSwitch:pressed /template/ Border#SwitchKnobBounds"> <Style Selector="^:disabled /template/ Border#SwitchKnobBounds">
<Setter Property="Background" Value="{DynamicResource ToggleSwitchFillOnPressed}"/> <Setter Property="Background" Value="{DynamicResource ToggleSwitchFillOnDisabled}" />
<Setter Property="BorderBrush" Value="{DynamicResource ToggleSwitchStrokeOnPressed}"/> <Setter Property="BorderBrush" Value="{DynamicResource ToggleSwitchStrokeOnDisabled}" />
</Style> </Style>
<Style Selector="ToggleSwitch:pressed /template/ Ellipse#SwitchKnobOff"> <!-- CheckedState -->
<Setter Property="Fill" Value="{DynamicResource ToggleSwitchKnobFillOffPressed}"/> <Style Selector="^:checked /template/ Border#OuterBorder">
</Style> <Setter Property="Opacity" Value="0" />
</Style>
<Style Selector="ToggleSwitch:pressed /template/ Ellipse#SwitchKnobOn">
<Setter Property="Fill" Value="{DynamicResource ToggleSwitchKnobFillOnPressed}"/> <Style Selector="^:checked /template/ Ellipse#SwitchKnobOff">
</Style> <Setter Property="Opacity" Value="0" />
</Style>
<Style Selector="ToggleSwitch:pressed /template/ Grid#SwitchAreaGrid">
<Setter Property="Background" Value="{DynamicResource ToggleSwitchContainerBackgroundPressed}"/> <Style Selector="^:checked /template/ Border#SwitchKnobBounds">
</Style> <Setter Property="Opacity" Value="1" />
</Style>
<!-- DisabledState -->
<Style Selector="ToggleSwitch:disabled"> <Style Selector="^:checked /template/ Ellipse#SwitchKnobOn">
<Setter Property="Foreground" Value="{DynamicResource ToggleSwitchHeaderForegroundDisabled}"/> <Setter Property="Opacity" Value="1" />
</Style> </Style>
<Style Selector="ToggleSwitch:disabled /template/ Border#OuterBorder"> <Style Selector="^:checked /template/ ContentPresenter#PART_OffContentPresenter">
<Setter Property="BorderBrush" Value="{DynamicResource ToggleSwitchStrokeOffDisabled}"/> <Setter Property="Opacity" Value="0" />
<Setter Property="Background" Value="{DynamicResource ToggleSwitchFillOffDisabled}"/> </Style>
</Style>
<Style Selector="^:checked /template/ ContentPresenter#PART_OnContentPresenter">
<Style Selector="ToggleSwitch:disabled /template/ Ellipse#SwitchKnobOff"> <Setter Property="Opacity" Value="1" />
<Setter Property="Fill" Value="{DynamicResource ToggleSwitchKnobFillOffDisabled}"/> </Style>
</Style>
<!--UncheckedState -->
<Style Selector="ToggleSwitch:disabled /template/ Ellipse#SwitchKnobOn"> <Style Selector="^:unchecked /template/ Border#OuterBorder">
<Setter Property="Fill" Value="{DynamicResource ToggleSwitchKnobFillOnDisabled}"/> <Setter Property="Opacity" Value="1" />
</Style> </Style>
<Style Selector="ToggleSwitch:disabled /template/ Border#SwitchKnobBounds"> <Style Selector="^:unchecked /template/ Ellipse#SwitchKnobOff">
<Setter Property="Background" Value="{DynamicResource ToggleSwitchFillOnDisabled}"/> <Setter Property="Opacity" Value="1" />
<Setter Property="BorderBrush" Value="{DynamicResource ToggleSwitchStrokeOnDisabled}"/> </Style>
</Style>
<Style Selector="^:unchecked /template/ Ellipse#SwitchKnobOn">
<!-- CheckedState --> <Setter Property="Opacity" Value="0" />
<Style Selector="ToggleSwitch:checked /template/ Border#OuterBorder"> </Style>
<Setter Property="Opacity" Value="0"/>
</Style> <Style Selector="^:unchecked /template/ Border#SwitchKnobBounds">
<Setter Property="Opacity" Value="0" />
<Style Selector="ToggleSwitch:checked /template/ Ellipse#SwitchKnobOff"> </Style>
<Setter Property="Opacity" Value="0"/>
</Style> <Style Selector="^:unchecked /template/ ContentPresenter#PART_OffContentPresenter">
<Setter Property="Opacity" Value="1" />
<Style Selector="ToggleSwitch:checked /template/ Border#SwitchKnobBounds"> </Style>
<Setter Property="Opacity" Value="1"/>
</Style> <Style Selector="^:unchecked /template/ ContentPresenter#PART_OnContentPresenter">
<Setter Property="Opacity" Value="0" />
<Style Selector="ToggleSwitch:checked /template/ Ellipse#SwitchKnobOn"> </Style>
<Setter Property="Opacity" Value="1"/> </ControlTheme>
</Style> </ResourceDictionary>
<Style Selector="ToggleSwitch:checked /template/ ContentPresenter#PART_OffContentPresenter">
<Setter Property="Opacity" Value="0"/>
</Style>
<Style Selector="ToggleSwitch:checked /template/ ContentPresenter#PART_OnContentPresenter">
<Setter Property="Opacity" Value="1"/>
</Style>
<!--UncheckedState -->
<Style Selector="ToggleSwitch:unchecked /template/ Border#OuterBorder">
<Setter Property="Opacity" Value="1"/>
</Style>
<Style Selector="ToggleSwitch:unchecked /template/ Ellipse#SwitchKnobOff">
<Setter Property="Opacity" Value="1"/>
</Style>
<Style Selector="ToggleSwitch:unchecked /template/ Ellipse#SwitchKnobOn">
<Setter Property="Opacity" Value="0"/>
</Style>
<Style Selector="ToggleSwitch:unchecked /template/ Border#SwitchKnobBounds">
<Setter Property="Opacity" Value="0"/>
</Style>
<Style Selector="ToggleSwitch:unchecked /template/ ContentPresenter#PART_OffContentPresenter">
<Setter Property="Opacity" Value="1"/>
</Style>
<Style Selector="ToggleSwitch:unchecked /template/ ContentPresenter#PART_OnContentPresenter">
<Setter Property="Opacity" Value="0"/>
</Style>
</Styles>

40
src/Avalonia.Themes.Default/Controls/ToolTip.xaml

@ -1,18 +1,22 @@
<Style xmlns="https://github.com/avaloniaui" Selector="ToolTip"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}"/> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/> <ControlTheme x:Key="{x:Type ToolTip}"
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}"/> TargetType="ToolTip">
<Setter Property="Padding" Value="4,2"/> <Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
<Setter Property="Template"> <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" />
<ControlTemplate> <Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}" />
<ContentPresenter Name="PART_ContentPresenter" <Setter Property="Padding" Value="4,2" />
Background="{TemplateBinding Background}" <Setter Property="Template">
BorderBrush="{TemplateBinding BorderBrush}" <ControlTemplate>
BorderThickness="{TemplateBinding BorderThickness}" <ContentPresenter Name="PART_ContentPresenter"
CornerRadius="{TemplateBinding CornerRadius}" Padding="{TemplateBinding Padding}"
ContentTemplate="{TemplateBinding ContentTemplate}" Background="{TemplateBinding Background}"
Content="{TemplateBinding Content}" BorderBrush="{TemplateBinding BorderBrush}"
Padding="{TemplateBinding Padding}"/> BorderThickness="{TemplateBinding BorderThickness}"
</ControlTemplate> Content="{TemplateBinding Content}"
</Setter> ContentTemplate="{TemplateBinding ContentTemplate}"
</Style> CornerRadius="{TemplateBinding CornerRadius}" />
</ControlTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>

23
src/Avalonia.Themes.Default/Controls/TransitioningContentControl.xaml

@ -1,20 +1,21 @@
<Styles xmlns="https://github.com/avaloniaui" <ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style Selector="TransitioningContentControl"> <ControlTheme x:Key="{x:Type TransitioningContentControl}"
<!-- Set Defaults --> TargetType="TransitioningContentControl">
<!-- Set Defaults -->
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<ContentPresenter Name="PART_ContentPresenter" <ContentPresenter Name="PART_ContentPresenter"
Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Background="{TemplateBinding Background}" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding CurrentContent}" Content="{TemplateBinding CurrentContent}"
Padding="{TemplateBinding Padding}" ContentTemplate="{TemplateBinding ContentTemplate}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" CornerRadius="{TemplateBinding CornerRadius}" />
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"/>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style> </ControlTheme>
</Styles> </ResourceDictionary>

58
src/Avalonia.Themes.Default/Controls/TreeView.xaml

@ -1,27 +1,31 @@
<Style xmlns="https://github.com/avaloniaui" Selector="TreeView"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Setter Property="Background" Value="Transparent"/> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/> <ControlTheme x:Key="{x:Type TreeView}"
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}"/> TargetType="TreeView">
<Setter Property="Padding" Value="4"/> <Setter Property="Background" Value="Transparent" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/> <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/> <Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}" />
<Setter Property="ScrollViewer.IsScrollChainingEnabled" Value="True" /> <Setter Property="Padding" Value="4" />
<Setter Property="Template"> <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
<ControlTemplate> <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<Border BorderBrush="{TemplateBinding BorderBrush}" <Setter Property="ScrollViewer.IsScrollChainingEnabled" Value="True" />
BorderThickness="{TemplateBinding BorderThickness}" <Setter Property="Template">
CornerRadius="{TemplateBinding CornerRadius}"> <ControlTemplate>
<ScrollViewer Background="{TemplateBinding Background}" <Border BorderBrush="{TemplateBinding BorderBrush}"
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}" BorderThickness="{TemplateBinding BorderThickness}"
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}" CornerRadius="{TemplateBinding CornerRadius}">
IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}" <ScrollViewer AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}"
AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}"> Background="{TemplateBinding Background}"
<ItemsPresenter Name="PART_ItemsPresenter" HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
Items="{TemplateBinding Items}" IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}"
ItemsPanel="{TemplateBinding ItemsPanel}" VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}">
Margin="{TemplateBinding Padding}"/> <ItemsPresenter Name="PART_ItemsPresenter"
</ScrollViewer> Margin="{TemplateBinding Padding}"
</Border> Items="{TemplateBinding Items}"
</ControlTemplate> ItemsPanel="{TemplateBinding ItemsPanel}" />
</Setter> </ScrollViewer>
</Style> </Border>
</ControlTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>

159
src/Avalonia.Themes.Default/Controls/TreeViewItem.xaml

@ -1,93 +1,100 @@
<Styles xmlns="https://github.com/avaloniaui" <ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:Avalonia.Controls.Converters;assembly=Avalonia.Controls"> xmlns:converters="clr-namespace:Avalonia.Controls.Converters;assembly=Avalonia.Controls">
<Style Selector="TreeViewItem"> <converters:MarginMultiplierConverter x:Key="LeftMarginConverter"
<Style.Resources> Indent="16"
<converters:MarginMultiplierConverter Indent="16" Left="True" x:Key="LeftMarginConverter" /> Left="True" />
</Style.Resources>
<Setter Property="Padding" Value="2"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Template">
<ControlTemplate>
<StackPanel>
<Border Name="SelectionBorder"
Focusable="True"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
TemplatedControl.IsTemplateFocusTarget="True">
<Grid Name="PART_Header"
ColumnDefinitions="16, *"
Margin="{TemplateBinding Level, Mode=OneWay, Converter={StaticResource LeftMarginConverter}}" >
<ToggleButton Name="expander"
Focusable="False"
IsChecked="{TemplateBinding IsExpanded, Mode=TwoWay}"/>
<ContentPresenter Name="PART_HeaderPresenter"
Focusable="False"
Content="{TemplateBinding Header}"
HorizontalContentAlignment="{TemplateBinding HorizontalAlignment}"
Padding="{TemplateBinding Padding}"
Grid.Column="1"/>
</Grid>
</Border>
<ItemsPresenter Name="PART_ItemsPresenter"
IsVisible="{TemplateBinding IsExpanded}"
Items="{TemplateBinding Items}"
ItemsPanel="{TemplateBinding ItemsPanel}"/>
</StackPanel>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="TreeViewItem /template/ ToggleButton#expander"> <ControlTheme x:Key="DefaultTreeViewItemToggleButtonTheme"
<Setter Property="Template"> TargetType="ToggleButton">
<ControlTemplate> <Setter Property="Template">
<Border Background="Transparent" <ControlTemplate>
Width="14" <Border Width="14"
Height="12" Height="12"
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center"> VerticalAlignment="Center"
<Path Fill="{DynamicResource ThemeForegroundBrush}" Background="Transparent">
HorizontalAlignment="Center" <Path HorizontalAlignment="Center"
VerticalAlignment="Center" VerticalAlignment="Center"
Data="M 0 2 L 4 6 L 0 10 Z"/> Data="M 0 2 L 4 6 L 0 10 Z"
</Border> Fill="{DynamicResource ThemeForegroundBrush}" />
</ControlTemplate> </Border>
</Setter> </ControlTemplate>
</Style> </Setter>
<Style Selector="TreeViewItem /template/ ContentPresenter#PART_HeaderPresenter"> <Style Selector="^:checked">
<Setter Property="Padding" Value="2"/> <Setter Property="RenderTransform">
<RotateTransform Angle="45" />
</Setter>
</Style> </Style>
</ControlTheme>
<ControlTheme x:Key="{x:Type TreeViewItem}"
TargetType="TreeViewItem">
<Setter Property="Padding" Value="2" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Template">
<ControlTemplate>
<StackPanel>
<Border Name="SelectionBorder"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
Focusable="True"
TemplatedControl.IsTemplateFocusTarget="True">
<Grid Name="PART_Header"
Margin="{TemplateBinding Level,
Mode=OneWay,
Converter={StaticResource LeftMarginConverter}}"
ColumnDefinitions="16, *">
<ToggleButton Name="PART_ExpandCollapseChevron"
Focusable="False"
IsChecked="{TemplateBinding IsExpanded,
Mode=TwoWay}"
Theme="{StaticResource DefaultTreeViewItemToggleButtonTheme}" />
<ContentPresenter Name="PART_HeaderPresenter"
Grid.Column="1"
Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalAlignment}"
Content="{TemplateBinding Header}"
Focusable="False" />
</Grid>
</Border>
<ItemsPresenter Name="PART_ItemsPresenter"
IsVisible="{TemplateBinding IsExpanded}"
Items="{TemplateBinding Items}"
ItemsPanel="{TemplateBinding ItemsPanel}" />
</StackPanel>
</ControlTemplate>
</Setter>
<Style Selector="TreeViewItem /template/ Border#SelectionBorder:pointerover"> <Style Selector="^ /template/ ContentPresenter#PART_HeaderPresenter">
<Setter Property="Background" Value="{DynamicResource ThemeControlHighlightMidBrush}"/> <Setter Property="Padding" Value="2" />
</Style> </Style>
<Style Selector="TreeViewItem:selected /template/ Border#SelectionBorder"> <Style Selector="^ /template/ Border#SelectionBorder:pointerover">
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush4}"/> <Setter Property="Background" Value="{DynamicResource ThemeControlHighlightMidBrush}" />
</Style> </Style>
<Style Selector="TreeViewItem:selected /template/ Border#SelectionBorder:focus"> <Style Selector="^:selected /template/ Border#SelectionBorder">
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush3}"/> <Setter Property="Background" Value="{DynamicResource ThemeAccentBrush4}" />
</Style> </Style>
<Style Selector="TreeViewItem:selected /template/ Border#SelectionBorder:pointerover"> <Style Selector="^:selected /template/ Border#SelectionBorder:focus">
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush3}"/> <Setter Property="Background" Value="{DynamicResource ThemeAccentBrush3}" />
</Style> </Style>
<Style Selector="TreeViewItem:selected /template/ Border#SelectionBorder:pointerover:focus"> <Style Selector="^:selected /template/ Border#SelectionBorder:pointerover">
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush2}"/> <Setter Property="Background" Value="{DynamicResource ThemeAccentBrush3}" />
</Style> </Style>
<Style Selector="TreeViewItem /template/ ToggleButton#expander:checked"> <Style Selector="^:selected /template/ Border#SelectionBorder:pointerover:focus">
<Setter Property="RenderTransform"> <Setter Property="Background" Value="{DynamicResource ThemeAccentBrush2}" />
<RotateTransform Angle="45"/>
</Setter>
</Style> </Style>
<Style Selector="TreeViewItem:empty /template/ ToggleButton#expander"> <Style Selector="^:empty /template/ ToggleButton#PART_ExpandCollapseChevron">
<Setter Property="IsVisible" Value="False"/> <Setter Property="IsVisible" Value="False" />
</Style> </Style>
</Styles> </ControlTheme>
</ResourceDictionary>

39
src/Avalonia.Themes.Default/Controls/UserControl.xaml

@ -1,16 +1,25 @@
<Style xmlns="https://github.com/avaloniaui" Selector=":is(UserControl)"> <Style xmlns="https://github.com/avaloniaui"
<Setter Property="Template"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
<ControlTemplate> Selector=":is(UserControl)">
<ContentPresenter Name="PART_ContentPresenter" <Style.Resources>
Background="{TemplateBinding Background}" <ControlTheme x:Key="DefaultUserControl"
BorderBrush="{TemplateBinding BorderBrush}" TargetType="UserControl">
BorderThickness="{TemplateBinding BorderThickness}" <Setter Property="Template">
CornerRadius="{TemplateBinding CornerRadius}" <ControlTemplate>
ContentTemplate="{TemplateBinding ContentTemplate}" <ContentPresenter Name="PART_ContentPresenter"
Content="{TemplateBinding Content}" Padding="{TemplateBinding Padding}"
Padding="{TemplateBinding Padding}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"/> Background="{TemplateBinding Background}"
</ControlTemplate> BorderBrush="{TemplateBinding BorderBrush}"
</Setter> BorderThickness="{TemplateBinding BorderThickness}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
CornerRadius="{TemplateBinding CornerRadius}" />
</ControlTemplate>
</Setter>
</ControlTheme>
</Style.Resources>
<Setter Property="Theme" Value="{StaticResource DefaultUserControl}" />
</Style> </Style>

59
src/Avalonia.Themes.Default/Controls/Window.xaml

@ -1,26 +1,33 @@
<Style xmlns="https://github.com/avaloniaui" Selector="Window"> <ResourceDictionary xmlns="https://github.com/avaloniaui"
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}"/> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Setter Property="TransparencyBackgroundFallback" Value="{DynamicResource HighlightForegroundColor}" /> <ControlTheme x:Key="{x:Type Window}"
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}"/> TargetType="Window">
<Setter Property="FontSize" Value="{DynamicResource FontSizeNormal}"/> <Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
<Setter Property="Template"> <Setter Property="TransparencyBackgroundFallback" Value="{DynamicResource HighlightForegroundColor}" />
<ControlTemplate> <Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" />
<Panel> <Setter Property="FontSize" Value="{DynamicResource FontSizeNormal}" />
<Border Name="PART_TransparencyFallback" IsHitTestVisible="False" /> <Setter Property="Template">
<Border Background="{TemplateBinding Background}" IsHitTestVisible="False" /> <ControlTemplate>
<Panel Background="Transparent" Margin="{TemplateBinding WindowDecorationMargin}" /> <Panel>
<VisualLayerManager> <Border Name="PART_TransparencyFallback"
<VisualLayerManager.ChromeOverlayLayer> IsHitTestVisible="False" />
<TitleBar /> <Border Background="{TemplateBinding Background}"
</VisualLayerManager.ChromeOverlayLayer> IsHitTestVisible="False" />
<ContentPresenter Name="PART_ContentPresenter" <Panel Margin="{TemplateBinding WindowDecorationMargin}"
ContentTemplate="{TemplateBinding ContentTemplate}" Background="Transparent" />
Content="{TemplateBinding Content}" <VisualLayerManager>
Margin="{TemplateBinding Padding}" <VisualLayerManager.ChromeOverlayLayer>
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" <TitleBar />
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/> </VisualLayerManager.ChromeOverlayLayer>
</VisualLayerManager> <ContentPresenter Name="PART_ContentPresenter"
</Panel> Margin="{TemplateBinding Padding}"
</ControlTemplate> HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
</Setter> VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
</Style> Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}" />
</VisualLayerManager>
</Panel>
</ControlTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>

81
src/Avalonia.Themes.Default/Controls/WindowNotificationManager.xaml

@ -1,45 +1,52 @@
<Styles xmlns="https://github.com/avaloniaui" <ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style Selector="WindowNotificationManager"> <ControlTheme x:Key="{x:Type WindowNotificationManager}"
<Setter Property="Margin" Value="0 0 8 8"/> TargetType="WindowNotificationManager">
<Setter Property="Template"> <Setter Property="Margin" Value="0 0 8 8" />
<ControlTemplate> <Setter Property="Template">
<ReversibleStackPanel Name="PART_Items"> <ControlTemplate>
<ReversibleStackPanel.DataTemplates> <ReversibleStackPanel Name="PART_Items">
<DataTemplate DataType="INotification"> <ReversibleStackPanel.DataTemplates>
<StackPanel Spacing="8" Margin="12"> <DataTemplate DataType="INotification">
<TextBlock Text="{Binding Title}" FontWeight="Medium" /> <StackPanel Margin="12"
<TextBlock MaxHeight="80" Text="{Binding Message}" TextWrapping="Wrap" Margin="0,0,12,0"/> Spacing="8">
</StackPanel> <TextBlock FontWeight="Medium"
</DataTemplate> Text="{Binding Title}" />
<DataTemplate DataType="x:String"> <TextBlock MaxHeight="80"
<TextBlock Text="{Binding }" Margin="12" /> Margin="0,0,12,0"
</DataTemplate> Text="{Binding Message}"
</ReversibleStackPanel.DataTemplates> TextWrapping="Wrap" />
</ReversibleStackPanel> </StackPanel>
</ControlTemplate> </DataTemplate>
</Setter> <DataTemplate DataType="x:String">
</Style> <TextBlock Margin="12"
Text="{Binding}" />
</DataTemplate>
</ReversibleStackPanel.DataTemplates>
</ReversibleStackPanel>
</ControlTemplate>
</Setter>
<Style Selector="WindowNotificationManager:topleft /template/ ReversibleStackPanel#PART_Items"> <Style Selector="^:topleft /template/ ReversibleStackPanel#PART_Items">
<Setter Property="VerticalAlignment" Value="Top"/> <Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="HorizontalAlignment" Value="Left"/> <Setter Property="HorizontalAlignment" Value="Left" />
</Style> </Style>
<Style Selector="WindowNotificationManager:topright /template/ ReversibleStackPanel#PART_Items"> <Style Selector="^:topright /template/ ReversibleStackPanel#PART_Items">
<Setter Property="VerticalAlignment" Value="Top"/> <Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="HorizontalAlignment" Value="Right"/> <Setter Property="HorizontalAlignment" Value="Right" />
</Style> </Style>
<Style Selector="WindowNotificationManager:bottomleft /template/ ReversibleStackPanel#PART_Items"> <Style Selector="^:bottomleft /template/ ReversibleStackPanel#PART_Items">
<Setter Property="ReverseOrder" Value="True"/> <Setter Property="ReverseOrder" Value="True" />
<Setter Property="VerticalAlignment" Value="Bottom"/> <Setter Property="VerticalAlignment" Value="Bottom" />
<Setter Property="HorizontalAlignment" Value="Left"/> <Setter Property="HorizontalAlignment" Value="Left" />
</Style> </Style>
<Style Selector="WindowNotificationManager:bottomright /template/ ReversibleStackPanel#PART_Items"> <Style Selector="^:bottomright /template/ ReversibleStackPanel#PART_Items">
<Setter Property="ReverseOrder" Value="True"/> <Setter Property="ReverseOrder" Value="True" />
<Setter Property="VerticalAlignment" Value="Bottom"/> <Setter Property="VerticalAlignment" Value="Bottom" />
<Setter Property="HorizontalAlignment" Value="Right"/> <Setter Property="HorizontalAlignment" Value="Right" />
</Style> </Style>
</Styles> </ControlTheme>
</ResourceDictionary>

143
src/Avalonia.Themes.Default/DefaultTheme.xaml

@ -1,70 +1,75 @@
<Styles xmlns="https://github.com/avaloniaui" <Styles x:Class="Avalonia.Themes.Default.DefaultTheme"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="https://github.com/avaloniaui"
x:Class="Avalonia.Themes.Default.DefaultTheme"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- Define ToolTip first so its styles can be overriden by other controls (e.g. TextBox) --> <Styles.Resources>
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/ToolTip.xaml"/> <ResourceDictionary>
<!-- PathIcon also needs to be defined early so it can be overriden by other styles (e.g. ComboBox) --> <ResourceDictionary.MergedDictionaries>
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/PathIcon.xaml" /> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/Button.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/DataValidationErrors.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/RadioButton.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/FocusAdorner.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/Expander.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/Button.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/RepeatButton.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/Carousel.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/ToggleSwitch.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/CheckBox.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/ButtonSpinner.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/CaptionButtons.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/ToggleButton.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/ComboBox.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/DropDownButton.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/ComboBoxItem.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/PathIcon.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/ContentControl.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/CheckBox.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/DropDownButton.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/ToolTip.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/Label.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/Label.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/GridSplitter.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/ComboBoxItem.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/ItemsControl.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/ComboBox.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/ListBox.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/Window.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/ListBoxItem.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/Carousel.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/Menu.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/CaptionButtons.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/ContextMenu.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/TitleBar.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/MenuItem.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/TextBox.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/OverlayPopupHost.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/AutoCompleteBox.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/PopupRoot.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/DataValidationErrors.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/ProgressBar.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/ContentControl.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/RadioButton.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/FlyoutPresenter.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/RepeatButton.xaml" /> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/MenuFlyoutPresenter.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/Separator.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/GridSplitter.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/Slider.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/ItemsControl.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/ScrollBar.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/ListBoxItem.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/ScrollViewer.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/ListBox.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/TabStrip.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/ScrollBar.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/TabStripItem.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/ScrollViewer.xaml" />
<!-- TabControl needs to come after TabStrip as it redefines the inner TabStrip.ItemsPanel--> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/TabStrip.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/TabControl.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/TabStripItem.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/TabItem.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/TabControl.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/TextBox.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/TabItem.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/ToggleButton.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/PopupRoot.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/TransitioningContentControl.xaml" /> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/OverlayPopupHost.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/Expander.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/WindowNotificationManager.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/TitleBar.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/EmbeddableControlRoot.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/TreeView.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/TransitioningContentControl.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/TreeViewItem.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/TreeView.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/UserControl.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/TreeViewItem.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/Window.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/ProgressBar.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/EmbeddableControlRoot.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/Separator.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/CalendarButton.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/Menu.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/CalendarDayButton.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/MenuItem.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/CalendarItem.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/ContextMenu.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/Calendar.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/CalendarButton.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/CalendarDatePicker.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/CalendarDayButton.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/ButtonSpinner.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/CalendarItem.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/NumericUpDown.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/Calendar.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/AutoCompleteBox.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/CalendarDatePicker.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/WindowNotificationManager.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/Slider.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/NotificationCard.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/NotificationCard.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/NativeMenuBar.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/NativeMenuBar.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/ToggleSwitch.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/NumericUpDown.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/SplitButton.xaml" /> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/DateTimePickerShared.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/SplitView.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/DatePicker.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/DatePicker.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/TimePicker.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/TimePicker.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/SplitView.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/FlyoutPresenter.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/ManagedFileChooser.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/MenuFlyoutPresenter.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/SplitButton.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/ManagedFileChooser.xaml"/> <ResourceInclude Source="avares://Avalonia.Themes.Default/Controls/RichTextBlock.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/RichTextBlock.xaml"/> </ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Styles.Resources>
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/FocusAdorner.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Controls/UserControl.xaml" />
</Styles> </Styles>

Loading…
Cancel
Save