Browse Source

Merge branch 'master' into colorpicker-controltheme-updates

robloo 3 years ago
parent
commit
9b0b07ae16
74 changed files with 4621 additions and 4118 deletions
  1. 362 290
      src/Avalonia.Controls.DataGrid/Themes/Default.xaml
  2. 1 2
      src/Avalonia.Controls.DataGrid/Themes/Fluent.xaml
  3. 3 5
      src/Avalonia.Diagnostics/Diagnostics/Views/MainWindow.xaml
  4. 19 17
      src/Avalonia.Themes.Default/Controls/AutoCompleteBox.xaml
  5. 28 26
      src/Avalonia.Themes.Default/Controls/Button.xaml
  6. 85 103
      src/Avalonia.Themes.Default/Controls/ButtonSpinner.xaml
  7. 12 12
      src/Avalonia.Themes.Default/Controls/Calendar.xaml
  8. 41 49
      src/Avalonia.Themes.Default/Controls/CalendarButton.xaml
  9. 71 65
      src/Avalonia.Themes.Default/Controls/CalendarDatePicker.xaml
  10. 69 80
      src/Avalonia.Themes.Default/Controls/CalendarDayButton.xaml
  11. 67 72
      src/Avalonia.Themes.Default/Controls/CalendarItem.xaml
  12. 93 60
      src/Avalonia.Themes.Default/Controls/CaptionButtons.xaml
  13. 21 17
      src/Avalonia.Themes.Default/Controls/Carousel.xaml
  14. 49 46
      src/Avalonia.Themes.Default/Controls/CheckBox.xaml
  15. 34 47
      src/Avalonia.Themes.Default/Controls/ComboBox.xaml
  16. 30 33
      src/Avalonia.Themes.Default/Controls/ComboBoxItem.xaml
  17. 20 16
      src/Avalonia.Themes.Default/Controls/ContentControl.xaml
  18. 25 21
      src/Avalonia.Themes.Default/Controls/ContextMenu.xaml
  19. 48 43
      src/Avalonia.Themes.Default/Controls/DataValidationErrors.xaml
  20. 236 260
      src/Avalonia.Themes.Default/Controls/DatePicker.xaml
  21. 139 0
      src/Avalonia.Themes.Default/Controls/DateTimePickerShared.xaml
  22. 36 34
      src/Avalonia.Themes.Default/Controls/DropDownButton.xaml
  23. 24 19
      src/Avalonia.Themes.Default/Controls/EmbeddableControlRoot.xaml
  24. 221 161
      src/Avalonia.Themes.Default/Controls/Expander.xaml
  25. 11 9
      src/Avalonia.Themes.Default/Controls/FlyoutPresenter.xaml
  26. 5 4
      src/Avalonia.Themes.Default/Controls/FocusAdorner.xaml
  27. 10 11
      src/Avalonia.Themes.Default/Controls/GridSplitter.xaml
  28. 20 16
      src/Avalonia.Themes.Default/Controls/ItemsControl.xaml
  29. 22 18
      src/Avalonia.Themes.Default/Controls/Label.xaml
  30. 37 34
      src/Avalonia.Themes.Default/Controls/ListBox.xaml
  31. 34 32
      src/Avalonia.Themes.Default/Controls/ListBoxItem.xaml
  32. 181 138
      src/Avalonia.Themes.Default/Controls/ManagedFileChooser.xaml
  33. 83 17
      src/Avalonia.Themes.Default/Controls/Menu.xaml
  34. 12 9
      src/Avalonia.Themes.Default/Controls/MenuFlyoutPresenter.xaml
  35. 60 103
      src/Avalonia.Themes.Default/Controls/MenuItem.xaml
  36. 30 30
      src/Avalonia.Themes.Default/Controls/NativeMenuBar.xaml
  37. 88 83
      src/Avalonia.Themes.Default/Controls/NotificationCard.xaml
  38. 24 25
      src/Avalonia.Themes.Default/Controls/NumericUpDown.xaml
  39. 25 23
      src/Avalonia.Themes.Default/Controls/OverlayPopupHost.xaml
  40. 11 10
      src/Avalonia.Themes.Default/Controls/PathIcon.xaml
  41. 30 27
      src/Avalonia.Themes.Default/Controls/PopupRoot.xaml
  42. 86 69
      src/Avalonia.Themes.Default/Controls/ProgressBar.xaml
  43. 45 42
      src/Avalonia.Themes.Default/Controls/RadioButton.xaml
  44. 32 39
      src/Avalonia.Themes.Default/Controls/RepeatButton.xaml
  45. 11 7
      src/Avalonia.Themes.Default/Controls/RichTextBlock.xaml
  46. 146 137
      src/Avalonia.Themes.Default/Controls/ScrollBar.xaml
  47. 76 57
      src/Avalonia.Themes.Default/Controls/ScrollViewer.xaml
  48. 13 15
      src/Avalonia.Themes.Default/Controls/Separator.xaml
  49. 122 91
      src/Avalonia.Themes.Default/Controls/Slider.xaml
  50. 196 248
      src/Avalonia.Themes.Default/Controls/SplitButton.xaml
  51. 236 215
      src/Avalonia.Themes.Default/Controls/SplitView.xaml
  52. 50 51
      src/Avalonia.Themes.Default/Controls/TabControl.xaml
  53. 46 45
      src/Avalonia.Themes.Default/Controls/TabItem.xaml
  54. 8 9
      src/Avalonia.Themes.Default/Controls/TabStrip.xaml
  55. 18 15
      src/Avalonia.Themes.Default/Controls/TabStripItem.xaml
  56. 178 160
      src/Avalonia.Themes.Default/Controls/TextBox.xaml
  57. 255 212
      src/Avalonia.Themes.Default/Controls/TimePicker.xaml
  58. 46 34
      src/Avalonia.Themes.Default/Controls/TitleBar.xaml
  59. 32 30
      src/Avalonia.Themes.Default/Controls/ToggleButton.xaml
  60. 231 252
      src/Avalonia.Themes.Default/Controls/ToggleSwitch.xaml
  61. 22 18
      src/Avalonia.Themes.Default/Controls/ToolTip.xaml
  62. 12 11
      src/Avalonia.Themes.Default/Controls/TransitioningContentControl.xaml
  63. 31 27
      src/Avalonia.Themes.Default/Controls/TreeView.xaml
  64. 83 76
      src/Avalonia.Themes.Default/Controls/TreeViewItem.xaml
  65. 24 15
      src/Avalonia.Themes.Default/Controls/UserControl.xaml
  66. 33 26
      src/Avalonia.Themes.Default/Controls/Window.xaml
  67. 44 37
      src/Avalonia.Themes.Default/Controls/WindowNotificationManager.xaml
  68. 74 69
      src/Avalonia.Themes.Default/DefaultTheme.xaml
  69. 2 2
      src/Avalonia.Themes.Fluent/Controls/ContextMenu.xaml
  70. 47 37
      src/Avalonia.Themes.Fluent/Controls/DataValidationErrors.xaml
  71. 0 1
      src/Avalonia.Themes.Fluent/Controls/FluentControls.xaml
  72. 3 3
      src/Avalonia.Themes.Fluent/Controls/Menu.xaml
  73. 1 0
      src/Avalonia.Themes.Fluent/Controls/MenuFlyoutPresenter.xaml
  74. 1 1
      tests/Avalonia.Markup.Xaml.UnitTests/Xaml/BasicTests.cs

+ 362 - 290
src/Avalonia.Controls.DataGrid/Themes/Default.xaml

@@ -1,305 +1,377 @@
 <Styles xmlns="https://github.com/avaloniaui"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
-  <!--TODO: Validation and Focus-->
-
   <Styles.Resources>
     <Thickness x:Key="DataGridTextColumnCellTextBlockMargin">4</Thickness>
-  </Styles.Resources>
-  
-  <Style Selector="DataGridCell">
-    <Setter Property="Background" Value="Transparent"/>
-    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
-    <Setter Property="VerticalContentAlignment" Value="Stretch" />
-    <Setter Property="Template">
-      <ControlTemplate>
-        <Border x:Name="CellBorder"
-                Background="{TemplateBinding Background}"
-                BorderBrush="{TemplateBinding BorderBrush}"
-                BorderThickness="{TemplateBinding BorderThickness}"
-                CornerRadius="{TemplateBinding CornerRadius}">
-          <Grid ColumnDefinitions="*,Auto">
-            <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}"
-                              Content="{TemplateBinding Content}"
-                              Margin="{TemplateBinding Padding}"
-                              Foreground="{TemplateBinding Foreground}"
-                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
-                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
-
-            <Rectangle Name="PART_RightGridLine"
-                       Grid.Column="1"
-                       VerticalAlignment="Stretch"
-                       Width="1" />
-          </Grid>
-        </Border>
-      </ControlTemplate>
-    </Setter>
-  </Style>
-  <Style Selector="DataGridCell > TextBlock#CellTextBlock">
-    <Setter Property="Margin" Value="{DynamicResource DataGridTextColumnCellTextBlockMargin}" />
-    <Setter Property="VerticalAlignment" Value="Center" />
-  </Style>
-
-  <Style Selector="DataGridColumnHeader">
-    <Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" />
-    <Setter Property="HorizontalContentAlignment" Value="Left" />
-    <Setter Property="VerticalContentAlignment" Value="Center" />
-    <Setter Property="SeparatorBrush" Value="{DynamicResource ThemeControlLowColor}" />
-    <Setter Property="Padding" Value="4" />
-    <Setter Property="Background" Value="{DynamicResource ThemeControlMidBrush}"/>
-
-    <Setter Property="Template">
-      <ControlTemplate>
-        <Border x:Name="HeaderBorder"
-                Background="{TemplateBinding Background}"
-                BorderBrush="{TemplateBinding BorderBrush}"
-                BorderThickness="{TemplateBinding BorderThickness}"
-                CornerRadius="{TemplateBinding CornerRadius}">
-          <Grid ColumnDefinitions="*,Auto">
-
-            <Grid ColumnDefinitions="*,Auto"
-                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
-                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
-                  Margin="{TemplateBinding Padding}">
-              <ContentPresenter Content="{TemplateBinding Content}"
-                                ContentTemplate="{TemplateBinding ContentTemplate}" />
-
-              <Path Name="SortIcon"
-                    Grid.Column="1"
-                    Fill="{TemplateBinding Foreground}"
-                    HorizontalAlignment="Left"
-                    VerticalAlignment="Center"
-                    Stretch="Uniform"
-                    Width="8"
-                    Margin="4,0,0,0"
-                    Data="F1 M -5.215,6.099L 5.215,6.099L 0,0L -5.215,6.099 Z "/>
-
+    <ControlTheme x:Key="DataGridCellTextBlockTheme"
+                  TargetType="TextBlock">
+      <Setter Property="Margin" Value="{DynamicResource DataGridTextColumnCellTextBlockMargin}" />
+      <Setter Property="VerticalAlignment" Value="Center" />
+    </ControlTheme>
+    <ControlTheme x:Key="DataGridCellTextBoxTheme"
+                  BasedOn="{StaticResource {x:Type TextBox}}"
+                  TargetType="TextBox">
+      <Setter Property="VerticalAlignment" Value="Stretch" />
+      <Setter Property="Background" Value="Transparent" />
+    </ControlTheme>
+
+    <ControlTheme x:Key="{x:Type DataGridCell}"
+                  TargetType="DataGridCell">
+      <Setter Property="Background" Value="Transparent" />
+      <Setter Property="HorizontalContentAlignment" Value="Stretch" />
+      <Setter Property="VerticalContentAlignment" Value="Stretch" />
+      <Setter Property="Template">
+        <ControlTemplate>
+          <Border x:Name="CellBorder"
+                  Background="{TemplateBinding Background}"
+                  BorderBrush="{TemplateBinding BorderBrush}"
+                  BorderThickness="{TemplateBinding BorderThickness}"
+                  CornerRadius="{TemplateBinding CornerRadius}">
+            <Grid ColumnDefinitions="*,Auto">
+              <ContentPresenter Margin="{TemplateBinding Padding}"
+                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
+                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
+                                Content="{TemplateBinding Content}"
+                                ContentTemplate="{TemplateBinding ContentTemplate}"
+                                Foreground="{TemplateBinding Foreground}" />
+
+              <Rectangle Name="PART_RightGridLine"
+                         Grid.Column="1"
+                         Width="1"
+                         VerticalAlignment="Stretch" />
             </Grid>
+          </Border>
+        </ControlTemplate>
+      </Setter>
+    </ControlTheme>
+
+    <ControlTheme x:Key="{x:Type DataGridColumnHeader}"
+                  TargetType="DataGridColumnHeader">
+      <Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" />
+      <Setter Property="HorizontalContentAlignment" Value="Left" />
+      <Setter Property="VerticalContentAlignment" Value="Center" />
+      <Setter Property="SeparatorBrush" Value="{DynamicResource ThemeControlLowColor}" />
+      <Setter Property="Padding" Value="4" />
+      <Setter Property="Background" Value="{DynamicResource ThemeControlMidBrush}" />
+      <Setter Property="Template">
+        <ControlTemplate>
+          <Border x:Name="HeaderBorder"
+                  Background="{TemplateBinding Background}"
+                  BorderBrush="{TemplateBinding BorderBrush}"
+                  BorderThickness="{TemplateBinding BorderThickness}"
+                  CornerRadius="{TemplateBinding CornerRadius}">
+            <Grid ColumnDefinitions="*,Auto">
+
+              <Grid Margin="{TemplateBinding Padding}"
+                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
+                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
+                    ColumnDefinitions="*,Auto">
+                <ContentPresenter Content="{TemplateBinding Content}"
+                                  ContentTemplate="{TemplateBinding ContentTemplate}" />
+
+                <Path Name="SortIcon"
+                      Grid.Column="1"
+                      Width="8"
+                      Margin="4,0,0,0"
+                      HorizontalAlignment="Left"
+                      VerticalAlignment="Center"
+                      Data="F1 M -5.215,6.099L 5.215,6.099L 0,0L -5.215,6.099 Z "
+                      Fill="{TemplateBinding Foreground}"
+                      IsVisible="False"
+                      Stretch="Uniform" />
+
+              </Grid>
+
+              <Rectangle Name="VerticalSeparator"
+                         Grid.Column="1"
+                         Width="1"
+                         VerticalAlignment="Stretch"
+                         Fill="{TemplateBinding SeparatorBrush}"
+                         IsVisible="{TemplateBinding AreSeparatorsVisible}" />
 
-            <Rectangle Name="VerticalSeparator"
-                       Grid.Column="1" Width="1"
-                       VerticalAlignment="Stretch"
+            </Grid>
+          </Border>
+        </ControlTemplate>
+      </Setter>
+
+      <Style Selector="^:focus-visible /template/ Grid#FocusVisual">
+        <Setter Property="IsVisible" Value="True" />
+      </Style>
+
+      <Style Selector="^:pointerover /template/ Grid#PART_ColumnHeaderRoot">
+        <Setter Property="Background" Value="{DynamicResource DataGridColumnHeaderHoveredBackgroundBrush}" />
+      </Style>
+
+      <Style Selector="^:pressed /template/ Grid#PART_ColumnHeaderRoot">
+        <Setter Property="Background" Value="{DynamicResource DataGridColumnHeaderPressedBackgroundBrush}" />
+      </Style>
+
+      <Style Selector="^:dragIndicator">
+        <Setter Property="Opacity" Value="0.5" />
+      </Style>
+
+      <Style Selector="^:sortascending /template/ Path#SortIcon">
+        <Setter Property="IsVisible" Value="True" />
+      </Style>
+
+      <Style Selector="^:sortdescending /template/ Path#SortIcon">
+        <Setter Property="IsVisible" Value="True" />
+        <Setter Property="RenderTransform">
+          <Setter.Value>
+            <ScaleTransform ScaleX="1" ScaleY="-1" />
+          </Setter.Value>
+        </Setter>
+      </Style>
+    </ControlTheme>
+
+    <ControlTheme x:Key="{x:Type DataGridRowHeader}"
+                  TargetType="DataGridRowHeader">
+      <Setter Property="Focusable" Value="False" />
+      <Setter Property="Template">
+        <ControlTemplate>
+          <Grid x:Name="PART_Root"
+                ColumnDefinitions="Auto,*"
+                RowDefinitions="*,*,Auto">
+            <Border Grid.RowSpan="3"
+                    Grid.ColumnSpan="2"
+                    BorderBrush="{TemplateBinding SeparatorBrush}"
+                    BorderThickness="0,0,1,0">
+              <Grid Background="{TemplateBinding Background}">
+                <Rectangle x:Name="RowInvalidVisualElement"
+                           Stretch="Fill" />
+                <Rectangle x:Name="BackgroundRectangle"
+                           Stretch="Fill" />
+              </Grid>
+            </Border>
+            <Rectangle x:Name="HorizontalSeparator"
+                       Grid.Row="2"
+                       Grid.ColumnSpan="2"
+                       Height="1"
+                       Margin="1,0,1,0"
+                       HorizontalAlignment="Stretch"
                        Fill="{TemplateBinding SeparatorBrush}"
                        IsVisible="{TemplateBinding AreSeparatorsVisible}" />
 
+            <ContentPresenter Grid.RowSpan="2"
+                              Grid.Column="1"
+                              HorizontalAlignment="Center"
+                              VerticalAlignment="Center"
+                              Content="{TemplateBinding Content}" />
           </Grid>
-        </Border>
-      </ControlTemplate>
-    </Setter>
-  </Style>
-
-  <Style Selector="DataGridColumnHeader:dragIndicator">
-    <Setter Property="Opacity" Value="0.5"/>
-  </Style>
-
-  <Style Selector="DataGridColumnHeader /template/ Path#SortIcon">
-    <Setter Property="IsVisible" Value="False"/>
-    <Setter Property="RenderTransform">
-      <Setter.Value>
-        <ScaleTransform ScaleX="0.9" ScaleY="0.9" />
-      </Setter.Value>
-    </Setter>
-  </Style>
-
-  <Style Selector="DataGridColumnHeader:sortascending /template/ Path#SortIcon">
-    <Setter Property="IsVisible" Value="True"/>
-  </Style>
-
-  <Style Selector="DataGridColumnHeader:sortdescending /template/ Path#SortIcon">
-    <Setter Property="IsVisible" Value="True"/>
-    <Setter Property="RenderTransform">
-      <Setter.Value>
-        <ScaleTransform ScaleX="0.9" ScaleY="-0.9" />
-      </Setter.Value>
-    </Setter>
-  </Style>
-
-  <Style Selector="DataGridRow">
-    <Setter Property="Template">
-      <ControlTemplate>
-        <Border x:Name="RowBorder"
-                Background="{TemplateBinding Background}"
-                BorderBrush="{TemplateBinding BorderBrush}"
-                BorderThickness="{TemplateBinding BorderThickness}"
-                CornerRadius="{TemplateBinding CornerRadius}">
-          <DataGridFrozenGrid Name="PART_Root"
-                              RowDefinitions="*,Auto,Auto"
-                              ColumnDefinitions="Auto,*">
-
-            <Rectangle Name="BackgroundRectangle" Grid.RowSpan="2" Grid.ColumnSpan="2"/>
-
-            <DataGridRowHeader Grid.RowSpan="3" Name="PART_RowHeader" DataGridFrozenGrid.IsFrozen="True" />
-            <DataGridCellsPresenter Grid.Column="1" Name="PART_CellsPresenter" DataGridFrozenGrid.IsFrozen="True" />
-            <DataGridDetailsPresenter Grid.Row="1" Grid.Column="1" Name="PART_DetailsPresenter"/>
-            <Rectangle Grid.Row="2" Grid.Column="1" Name="PART_BottomGridLine" HorizontalAlignment="Stretch" Height="1" />
+        </ControlTemplate>
+      </Setter>
+    </ControlTheme>
+
+    <ControlTheme x:Key="{x:Type DataGridRow}"
+                  TargetType="DataGridRow">
+      <Setter Property="Background" Value="{Binding $parent[DataGrid].RowBackground}" />
+      <Setter Property="Template">
+        <ControlTemplate>
+          <Border x:Name="RowBorder"
+                  Background="{TemplateBinding Background}"
+                  BorderBrush="{TemplateBinding BorderBrush}"
+                  BorderThickness="{TemplateBinding BorderThickness}"
+                  CornerRadius="{TemplateBinding CornerRadius}">
+            <DataGridFrozenGrid Name="PART_Root"
+                                ColumnDefinitions="Auto,*"
+                                RowDefinitions="*,Auto,Auto">
+
+              <Rectangle Name="BackgroundRectangle"
+                         Grid.RowSpan="2"
+                         Grid.ColumnSpan="2" />
+
+              <DataGridRowHeader Name="PART_RowHeader"
+                                 Grid.RowSpan="3"
+                                 DataGridFrozenGrid.IsFrozen="True" />
+              <DataGridCellsPresenter Name="PART_CellsPresenter"
+                                      Grid.Column="1"
+                                      DataGridFrozenGrid.IsFrozen="True" />
+              <DataGridDetailsPresenter Name="PART_DetailsPresenter"
+                                        Grid.Row="1"
+                                        Grid.Column="1" />
+              <Rectangle Name="PART_BottomGridLine"
+                         Grid.Row="2"
+                         Grid.Column="1"
+                         Height="1"
+                         HorizontalAlignment="Stretch" />
+
+            </DataGridFrozenGrid>
+          </Border>
+        </ControlTemplate>
+      </Setter>
+
+      <Style Selector="^:nth-child(even)">
+        <Setter Property="Background" Value="{Binding $parent[DataGrid].AlternatingRowBackground}" />
+      </Style>
+
+      <Style Selector="^ /template/ Rectangle#BackgroundRectangle">
+        <Setter Property="IsVisible" Value="False" />
+        <Setter Property="Fill" Value="{DynamicResource HighlightBrush}" />
+      </Style>
+
+      <Style Selector="^:pointerover /template/ Rectangle#BackgroundRectangle">
+        <Setter Property="IsVisible" Value="True" />
+        <Setter Property="Opacity" Value="0.5" />
+      </Style>
+
+      <Style Selector="^:selected /template/ Rectangle#BackgroundRectangle">
+        <Setter Property="IsVisible" Value="True" />
+        <Setter Property="Opacity" Value="1" />
+      </Style>
+
+      <Style Selector="^:selected">
+        <Setter Property="Foreground" Value="{DynamicResource HighlightForegroundBrush}" />
+      </Style>
+    </ControlTheme>
+
+    <ControlTheme x:Key="DefaultDataGridRowGroupExpanderButtonTheme"
+                  TargetType="ToggleButton">
+      <Setter Property="Template">
+        <ControlTemplate>
+          <Border Grid.Column="0"
+                  Width="20"
+                  Height="20"
+                  HorizontalAlignment="Center"
+                  VerticalAlignment="Center"
+                  Background="Transparent">
+            <Path HorizontalAlignment="Center"
+                  VerticalAlignment="Center"
+                  Data="M 0 2 L 4 6 L 0 10 Z"
+                  Fill="{TemplateBinding Foreground}" />
+          </Border>
+        </ControlTemplate>
+      </Setter>
+      <Style Selector="^:checked /template/ Path">
+        <Setter Property="RenderTransform">
+          <RotateTransform Angle="90" />
+        </Setter>
+      </Style>
+    </ControlTheme>
+
+
+    <ControlTheme x:Key="{x:Type DataGridRowGroupHeader}"
+                  TargetType="DataGridRowGroupHeader">
+      <Setter Property="Background" Value="{DynamicResource ThemeControlMidHighBrush}" />
+      <Setter Property="Height" Value="20" />
+      <Setter Property="Template">
+        <ControlTemplate>
+          <DataGridFrozenGrid Name="Root"
+                              ColumnDefinitions="Auto,Auto,Auto,Auto"
+                              RowDefinitions="Auto,*,Auto">
+
+            <Rectangle Name="IndentSpacer"
+                       Grid.Row="1"
+                       Grid.Column="1" />
+            <ToggleButton Name="ExpanderButton"
+                          Grid.Row="1"
+                          Grid.Column="2"
+                          Margin="2,0,0,0"
+                          Background="{TemplateBinding Background}"
+                          BorderBrush="{TemplateBinding BorderBrush}"
+                          BorderThickness="{TemplateBinding BorderThickness}"
+                          CornerRadius="{TemplateBinding CornerRadius}"
+                          Foreground="{TemplateBinding Foreground}"
+                          Theme="{StaticResource DefaultDataGridRowGroupExpanderButtonTheme}" />
+
+            <StackPanel Grid.Row="1"
+                        Grid.Column="3"
+                        Margin="0,1,0,1"
+                        VerticalAlignment="Center"
+                        Orientation="Horizontal">
+              <TextBlock Name="PropertyNameElement"
+                         Margin="4,0,0,0"
+                         IsVisible="{TemplateBinding IsPropertyNameVisible}" />
+              <TextBlock Margin="4,0,0,0"
+                         Text="{Binding Key}" />
+              <TextBlock Name="ItemCountElement"
+                         Margin="4,0,0,0"
+                         IsVisible="{TemplateBinding IsItemCountVisible}" />
+            </StackPanel>
+
+            <DataGridRowHeader Name="RowHeader"
+                               Grid.RowSpan="3"
+                               DataGridFrozenGrid.IsFrozen="True" />
 
           </DataGridFrozenGrid>
-        </Border>
-      </ControlTemplate>
-    </Setter>
-  </Style>
-
-  <Style Selector="DataGridRow">
-    <Setter Property="Background" Value="{Binding $parent[DataGrid].RowBackground}" />
-  </Style>
-  <Style Selector="DataGridRow:nth-child(even)">
-    <Setter Property="Background" Value="{Binding $parent[DataGrid].AlternatingRowBackground}" />
-  </Style>
-
-  <Style Selector="DataGridRow /template/ Rectangle#BackgroundRectangle">
-    <Setter Property="IsVisible" Value="False"/>
-    <Setter Property="Fill" Value="{DynamicResource HighlightBrush}" />
-  </Style>
-
-  <Style Selector="DataGridRow:pointerover /template/ Rectangle#BackgroundRectangle">
-    <Setter Property="IsVisible" Value="True"/>
-    <Setter Property="Opacity" Value="0.5"/>
-  </Style>
-
-  <Style Selector="DataGridRow:selected /template/ Rectangle#BackgroundRectangle">
-    <Setter Property="IsVisible" Value="True"/>
-    <Setter Property="Opacity" Value="1"/>
-  </Style>
-
-  <Style Selector="DataGridRow:selected">
-    <Setter Property="Foreground" Value="{DynamicResource HighlightForegroundBrush}" />
-  </Style>
-
-  <Style Selector="DataGridRowHeader">
-    <Setter Property="Focusable" Value="False" />
-    <Setter Property="Template">
-      <ControlTemplate>
-        <Grid x:Name="PART_Root"
-              RowDefinitions="*,*,Auto"
-              ColumnDefinitions="Auto,*">
-          <Border Grid.RowSpan="3"
-                  Grid.ColumnSpan="2"
-                  BorderBrush="{TemplateBinding SeparatorBrush}"
-                  BorderThickness="0,0,1,0">
-            <Grid Background="{TemplateBinding Background}">
-              <Rectangle x:Name="RowInvalidVisualElement"
-                         Stretch="Fill" />
-              <Rectangle x:Name="BackgroundRectangle"
-                         Stretch="Fill" />
+        </ControlTemplate>
+      </Setter>
+    </ControlTheme>
+
+    <ControlTheme x:Key="{x:Type DataGrid}"
+                  TargetType="DataGrid">
+      <Setter Property="RowBackground" Value="{DynamicResource ThemeAccentBrush4}" />
+      <Setter Property="AlternatingRowBackground" Value="#00FFFFFF" />
+      <Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
+      <Setter Property="HeadersVisibility" Value="Column" />
+      <Setter Property="HorizontalScrollBarVisibility" Value="Auto" />
+      <Setter Property="VerticalScrollBarVisibility" Value="Auto" />
+      <Setter Property="SelectionMode" Value="Extended" />
+      <Setter Property="HorizontalGridLinesBrush" Value="{DynamicResource ThemeBorderHighColor}" />
+      <Setter Property="VerticalGridLinesBrush" Value="{DynamicResource ThemeBorderHighColor}" />
+      <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderLowColor}" />
+      <Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}" />
+      <Setter Property="DropLocationIndicatorTemplate">
+        <Template>
+          <Rectangle Width="2"
+                     Fill="{DynamicResource ThemeBorderHighColor}" />
+        </Template>
+      </Setter>
+      <Setter Property="Template">
+        <ControlTemplate>
+          <Border x:Name="DataGridBorder"
+                  Background="{TemplateBinding Background}"
+                  BorderBrush="{TemplateBinding BorderBrush}"
+                  BorderThickness="{TemplateBinding BorderThickness}"
+                  CornerRadius="{TemplateBinding CornerRadius}">
+            <Grid ColumnDefinitions="Auto,*,Auto"
+                  RowDefinitions="Auto,*,Auto,Auto">
+              <DataGridColumnHeader Name="PART_TopLeftCornerHeader"
+                                    Width="22" />
+              <DataGridColumnHeadersPresenter Name="PART_ColumnHeadersPresenter"
+                                              Grid.Column="1" />
+              <DataGridColumnHeader Name="PART_TopRightCornerHeader"
+                                    Grid.Column="2" />
+              <Rectangle Name="PART_ColumnHeadersAndRowsSeparator"
+                         Grid.ColumnSpan="3"
+                         Height="1"
+                         VerticalAlignment="Bottom"
+                         Fill="{DynamicResource ThemeControlMidHighBrush}"
+                         StrokeThickness="1" />
+
+              <DataGridRowsPresenter Name="PART_RowsPresenter"
+                                     Grid.Row="1"
+                                     Grid.ColumnSpan="2">
+                <DataGridRowsPresenter.GestureRecognizers>
+                  <ScrollGestureRecognizer CanHorizontallyScroll="True"
+                                           CanVerticallyScroll="True" />
+                </DataGridRowsPresenter.GestureRecognizers>
+              </DataGridRowsPresenter>
+              <Rectangle Name="PART_BottomRightCorner"
+                         Grid.Row="2"
+                         Grid.Column="2"
+                         Fill="{DynamicResource ThemeControlMidHighBrush}" />
+              <Rectangle Name="BottomLeftCorner"
+                         Grid.Row="2"
+                         Grid.ColumnSpan="2"
+                         Fill="{DynamicResource ThemeControlMidHighBrush}" />
+              <ScrollBar Name="PART_VerticalScrollbar"
+                         Grid.Row="1"
+                         Grid.Column="2"
+                         Width="{DynamicResource ScrollBarThickness}"
+                         Orientation="Vertical" />
+
+              <Grid Grid.Row="2"
+                    Grid.Column="1"
+                    ColumnDefinitions="Auto,*">
+                <Rectangle Name="PART_FrozenColumnScrollBarSpacer" />
+                <ScrollBar Name="PART_HorizontalScrollbar"
+                           Grid.Column="1"
+                           Height="{DynamicResource ScrollBarThickness}"
+                           Orientation="Horizontal" />
+              </Grid>
             </Grid>
           </Border>
-          <Rectangle x:Name="HorizontalSeparator"
-                     Grid.Row="2"
-                     Grid.ColumnSpan="2"
-                     Height="1"
-                     Margin="1,0,1,0"
-                     HorizontalAlignment="Stretch"
-                     Fill="{TemplateBinding SeparatorBrush}"
-                     IsVisible="{TemplateBinding AreSeparatorsVisible}" />
-
-          <ContentPresenter Grid.RowSpan="2"
-                            Grid.Column="1"
-                            HorizontalAlignment="Center"
-                            VerticalAlignment="Center"
-                            Content="{TemplateBinding Content}" />
-        </Grid>
-      </ControlTemplate>
-    </Setter>
-  </Style>
-
-  <Style Selector="DataGridRowGroupHeader">
-    <Setter Property="Background" Value="{DynamicResource ThemeControlMidHighBrush}" />
-    <Setter Property="Height" Value="20"/>
-    <Setter Property="Template">
-      <ControlTemplate>
-        <DataGridFrozenGrid Name="Root"
-                            ColumnDefinitions="Auto,Auto,Auto,Auto"
-                            RowDefinitions="Auto,*,Auto">
-
-          <Rectangle Grid.Column="1" Grid.Row="1" Name="IndentSpacer" />
-          <ToggleButton Grid.Column="2" Grid.Row="1"
-                        Name="ExpanderButton"
-                        Margin="2,0,0,0"
-                        BorderBrush="{TemplateBinding BorderBrush}"
-                        BorderThickness="{TemplateBinding BorderThickness}"
-                        Background="{TemplateBinding Background}"
-                        CornerRadius="{TemplateBinding CornerRadius}"
-                        Foreground="{TemplateBinding Foreground}" />
-
-          <StackPanel Grid.Column="3" Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Center" Margin="0,1,0,1">
-            <TextBlock Name="PropertyNameElement" Margin="4,0,0,0" IsVisible="{TemplateBinding IsPropertyNameVisible}"/>
-            <TextBlock Margin="4,0,0,0" Text="{Binding Key}" />
-            <TextBlock Name="ItemCountElement" Margin="4,0,0,0" IsVisible="{TemplateBinding IsItemCountVisible}"/>
-          </StackPanel>
-
-          <DataGridRowHeader Name="RowHeader" Grid.RowSpan="3" DataGridFrozenGrid.IsFrozen="True"/>
-
-        </DataGridFrozenGrid>
-      </ControlTemplate>
-    </Setter>
-  </Style>
-
-  <Style Selector="DataGridRowGroupHeader /template/ ToggleButton#ExpanderButton">
-    <Setter Property="Template">
-      <ControlTemplate>
-        <Border Grid.Column="0" Width="20" Height="20" Background="Transparent" HorizontalAlignment="Center" VerticalAlignment="Center">
-          <Path Fill="{TemplateBinding Foreground}"
-                HorizontalAlignment="Center"
-                VerticalAlignment="Center"
-                Data="M 0 2 L 4 6 L 0 10 Z" />
-        </Border>
-      </ControlTemplate>
-    </Setter>
-  </Style>
-
-  <Style Selector="DataGridRowGroupHeader /template/ ToggleButton#ExpanderButton:checked /template/ Path">
-    <Setter Property="RenderTransform">
-      <RotateTransform Angle="90" />
-    </Setter>
-  </Style>
-
-  <Style Selector="DataGrid">
-    <Setter Property="RowBackground" Value="{DynamicResource ThemeAccentBrush4}" />
-    <Setter Property="AlternatingRowBackground" Value="#00FFFFFF" />
-    <Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
-    <Setter Property="HeadersVisibility" Value="Column" />
-    <Setter Property="HorizontalScrollBarVisibility" Value="Auto" />
-    <Setter Property="VerticalScrollBarVisibility" Value="Auto" />
-    <Setter Property="SelectionMode" Value="Extended" />
-    <Setter Property="HorizontalGridLinesBrush" Value="{DynamicResource ThemeBorderHighColor}" />
-    <Setter Property="VerticalGridLinesBrush" Value="{DynamicResource ThemeBorderHighColor}" />
-    <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderLowColor}"/>
-    <Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}" />
-    <Setter Property="DropLocationIndicatorTemplate">
-      <Template>
-        <Rectangle Fill="{DynamicResource ThemeBorderHighColor}" Width="2"/>
-      </Template>
-    </Setter>
-    <Setter Property="Template">
-      <ControlTemplate>
-        <Border x:Name="DataGridBorder"
-                Background="{TemplateBinding Background}"
-                BorderBrush="{TemplateBinding BorderBrush}"
-                BorderThickness="{TemplateBinding BorderThickness}"
-                CornerRadius="{TemplateBinding CornerRadius}">
-          <Grid RowDefinitions="Auto,*,Auto,Auto" ColumnDefinitions="Auto,*,Auto">
-
-            <DataGridColumnHeader Name="PART_TopLeftCornerHeader" Width="22" />
-            <DataGridColumnHeadersPresenter Name="PART_ColumnHeadersPresenter" Grid.Column="1"/>
-            <DataGridColumnHeader Name="PART_TopRightCornerHeader" Grid.Column="2"/>
-            <Rectangle Name="PART_ColumnHeadersAndRowsSeparator" Grid.ColumnSpan="3" VerticalAlignment="Bottom" StrokeThickness="1" Height="1" Fill="{DynamicResource ThemeControlMidHighBrush}"/>
-
-            <DataGridRowsPresenter Name="PART_RowsPresenter" Grid.ColumnSpan="2" Grid.Row="1">
-              <DataGridRowsPresenter.GestureRecognizers>
-                <ScrollGestureRecognizer CanHorizontallyScroll="True" CanVerticallyScroll="True" />
-              </DataGridRowsPresenter.GestureRecognizers>
-            </DataGridRowsPresenter>
-            <Rectangle Name="PART_BottomRightCorner" Fill="{DynamicResource ThemeControlMidHighBrush}" Grid.Column="2" Grid.Row="2" />
-            <Rectangle Name="BottomLeftCorner" Fill="{DynamicResource ThemeControlMidHighBrush}" Grid.Row="2" Grid.ColumnSpan="2" />
-            <ScrollBar Name="PART_VerticalScrollbar" Orientation="Vertical" Grid.Column="2" Grid.Row="1" Width="{DynamicResource ScrollBarThickness}"/>
-
-            <Grid Grid.Column="1" Grid.Row="2"
-                  ColumnDefinitions="Auto,*">
-              <Rectangle Name="PART_FrozenColumnScrollBarSpacer" />
-              <ScrollBar Name="PART_HorizontalScrollbar" Grid.Column="1" Orientation="Horizontal" Height="{DynamicResource ScrollBarThickness}"/>
-            </Grid>
-          </Grid>
-        </Border>
-      </ControlTemplate>
-    </Setter>
-  </Style>
+        </ControlTemplate>
+      </Setter>
+    </ControlTheme>
+  </Styles.Resources>
 </Styles>

+ 1 - 2
src/Avalonia.Controls.DataGrid/Themes/Fluent.xaml

@@ -57,8 +57,7 @@
       <Setter Property="VerticalAlignment" Value="Stretch" />
       <Setter Property="Background" Value="Transparent" />
       <Style Selector="^ /template/ DataValidationErrors">
-        <Setter Property="Template" Value="{DynamicResource TooltipDataValidationContentTemplate}" />
-        <Setter Property="ErrorTemplate" Value="{DynamicResource TooltipDataValidationErrorTemplate}" />
+        <Setter Property="Theme" Value="{StaticResource TooltipDataValidationErrors}" />
       </Style>
     </ControlTheme>
 

+ 3 - 5
src/Avalonia.Diagnostics/Diagnostics/Views/MainWindow.xaml

@@ -4,17 +4,15 @@
         xmlns:diag="clr-namespace:Avalonia.Diagnostics"
         xmlns:default="using:Avalonia.Themes.Default"
         Title="Avalonia DevTools"
-        x:Class="Avalonia.Diagnostics.Views.MainWindow">
+        x:Class="Avalonia.Diagnostics.Views.MainWindow"
+        Theme="{StaticResource {x:Type Window}}">
   <Window.DataTemplates>
     <diag:ViewLocator/>
   </Window.DataTemplates>
   
   <Window.Styles>
     <default:SimpleTheme Mode="Light"/>
-    <StyleInclude Source="resm:Avalonia.Controls.DataGrid.Themes.Default.xaml?assembly=Avalonia.Controls.DataGrid"/>
-    <Style Selector="DataGrid ContextMenu">
-      <Setter Property="Foreground" Value="Black"/>
-    </Style>
+    <StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Default.xaml"/>
     <StyleInclude Source="avares://Avalonia.Diagnostics/Diagnostics/Controls/ThicknessEditor.axaml" />
     <StyleInclude Source="avares://Avalonia.Diagnostics/Diagnostics/Controls/FilterTextBox.axaml" />
   </Window.Styles>

+ 19 - 17
src/Avalonia.Themes.Default/Controls/AutoCompleteBox.xaml

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

+ 28 - 26
src/Avalonia.Themes.Default/Controls/Button.xaml

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

+ 85 - 103
src/Avalonia.Themes.Default/Controls/ButtonSpinner.xaml

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

+ 12 - 12
src/Avalonia.Themes.Default/Controls/Calendar.xaml

@@ -1,12 +1,14 @@
 <!--
-// (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.
+  // (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.
 -->
 
-<Styles xmlns="https://github.com/avaloniaui">
-  <Style Selector="Calendar">
+<ResourceDictionary xmlns="https://github.com/avaloniaui"
+                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+  <ControlTheme x:Key="{x:Type Calendar}"
+                TargetType="Calendar">
     <!--<Setter Property="Focusable" Value="False" />-->
     <Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}" />
     <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderHighBrush}" />
@@ -17,16 +19,14 @@
         <StackPanel Name="Root"
                     HorizontalAlignment="Center"
                     ClipToBounds="True">
-
-                    <CalendarItem Name="CalendarItem"
+          <CalendarItem Name="CalendarItem"
                         Background="{TemplateBinding Background}"
                         BorderBrush="{TemplateBinding BorderBrush}"
                         BorderThickness="{TemplateBinding BorderThickness}"
                         CornerRadius="{TemplateBinding CornerRadius}"
-                        HeaderBackground="{TemplateBinding HeaderBackground}"/>
-
+                        HeaderBackground="{TemplateBinding HeaderBackground}" />
         </StackPanel>
       </ControlTemplate>
     </Setter>
-  </Style>
-</Styles>
+  </ControlTheme>
+</ResourceDictionary>

+ 41 - 49
src/Avalonia.Themes.Default/Controls/CalendarButton.xaml

@@ -1,81 +1,73 @@
 <!--
-// (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.
+  // (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.
 -->
 
-<Styles xmlns="https://github.com/avaloniaui">
-  <Style Selector="CalendarButton">
-    <Setter Property="Foreground" Value="{DynamicResource ThemeBorderHighBrush}" />
+<ResourceDictionary xmlns="https://github.com/avaloniaui"
+                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+  <ControlTheme x:Key="{x:Type CalendarButton}"
+                TargetType="CalendarButton">
+    <Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" />
     <Setter Property="Background" Value="{DynamicResource ThemeAccentBrush2}" />
     <Setter Property="FontSize" Value="{DynamicResource FontSizeSmall}" />
     <Setter Property="HorizontalContentAlignment" Value="Center" />
     <Setter Property="VerticalContentAlignment" Value="Center" />
     <Setter Property="MinWidth" Value="37" />
     <Setter Property="MinHeight" Value="38" />
-    <Setter Property="Focusable" Value="False"/>
+    <Setter Property="Focusable" Value="False" />
     <Setter Property="Template">
       <ControlTemplate>
         <Grid>
 
           <Rectangle Name="SelectedBackground"
-                     Opacity="0.75"
-                     Fill="{TemplateBinding Background}"/>
+                     Fill="{TemplateBinding Background}"
+                     IsVisible="False"
+                     Opacity="0.75" />
 
           <Rectangle Name="Background"
-                     Opacity="0.5"
-                     Fill="{TemplateBinding Background}"/>
+                     Fill="{TemplateBinding Background}"
+                     IsVisible="False"
+                     Opacity="0.5" />
 
-          <!--Focusable="False"-->
+          <!--  Focusable="False"  -->
           <ContentControl Name="Content"
-                          Foreground="{TemplateBinding Foreground}"
-                          ContentTemplate="{TemplateBinding ContentTemplate}"
-                          Content="{TemplateBinding Content}"
+                          Margin="1,0,1,1"
                           HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                           VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
+                          Content="{TemplateBinding Content}"
+                          ContentTemplate="{TemplateBinding ContentTemplate}"
                           FontSize="{TemplateBinding FontSize}"
-                          Margin="1,0,1,1"/>
+                          Foreground="{TemplateBinding Foreground}" />
 
           <Rectangle Name="FocusVisual"
-                     StrokeThickness="1"
+                     IsHitTestVisible="False"
+                     IsVisible="False"
                      Stroke="{DynamicResource HighlightBrush}"
-                     IsHitTestVisible="False"/>
+                     StrokeThickness="1" />
 
         </Grid>
       </ControlTemplate>
     </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">
-    <Setter Property="IsVisible" Value="False"/>
-  </Style>
-  <Style Selector="CalendarButton:selected /template/ Rectangle#SelectedBackground">
-    <Setter Property="IsVisible" Value="True"/>
-  </Style>
+    <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="CalendarButton /template/ ContentControl#Content">
-    <Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}"/>
-  </Style>
-  <Style Selector="CalendarButton:inactive /template/ ContentControl#Content">
-    <Setter Property="Foreground" Value="{DynamicResource ThemeForegroundLowBrush}"/>
-  </Style>
+    <Style Selector="^:selected /template/ Rectangle#SelectedBackground">
+      <Setter Property="IsVisible" Value="True" />
+    </Style>
 
+    <Style Selector="^:inactive /template/ ContentControl#Content">
+      <Setter Property="Foreground" Value="{DynamicResource ThemeForegroundLowBrush}" />
+    </Style>
 
-  <Style Selector="CalendarButton /template/ Rectangle#FocusVisual">
-    <Setter Property="IsVisible" Value="False"/>
-  </Style>
-  <Style Selector="CalendarButton:btnfocused /template/ Rectangle#FocusVisual">
-    <Setter Property="IsVisible" Value="True"/>
-  </Style>
-</Styles>
+    <Style Selector="^:btnfocused /template/ Rectangle#FocusVisual">
+      <Setter Property="IsVisible" Value="True" />
+    </Style>
+  </ControlTheme>
+</ResourceDictionary>

+ 71 - 65
src/Avalonia.Themes.Default/Controls/CalendarDatePicker.xaml

@@ -1,20 +1,21 @@
 <!--
-// (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.
+  // (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.
 -->
 
-<Styles xmlns="https://github.com/avaloniaui"
-        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-        xmlns:sys="clr-namespace:System;assembly=netstandard">
-  <Style Selector="CalendarDatePicker">
+<ResourceDictionary xmlns="https://github.com/avaloniaui"
+                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+                    xmlns:sys="using:System"
+                    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">
       <ControlTemplate>
         <Grid ColumnDefinitions="*,Auto">
@@ -24,110 +25,115 @@
             <Style Selector="Button.CalendarDropDown">
               <Setter Property="Template">
                 <ControlTemplate>
-                  <Grid Height="18"
-                        Width="19"
+                  <Grid Width="19"
+                        Height="18"
+                        Margin="0"
                         HorizontalAlignment="Center"
                         VerticalAlignment="Center"
-                        Margin="0"
                         Background="{DynamicResource ThemeControlLowBrush}"
+                        ClipToBounds="False"
                         ColumnDefinitions="*,*,*,*"
-                        RowDefinitions="23*,19*,19*,19*"
-                        ClipToBounds="False">
+                        RowDefinitions="23*,19*,19*,19*">
 
                     <Border Name="Highlight"
-                            Margin="-1"
-                            Grid.ColumnSpan="4"
                             Grid.Row="0"
                             Grid.RowSpan="4"
-                            BorderThickness="1"
-                            BorderBrush="{DynamicResource HighlightBrush}" />
-                    <Border Name="Background"
-                            Margin="0,-1,0,0"
                             Grid.ColumnSpan="4"
+                            Margin="-1"
+                            BorderBrush="{DynamicResource HighlightBrush}"
+                            BorderThickness="1" />
+                    <Border Name="Background"
                             Grid.Row="1"
                             Grid.RowSpan="3"
-                            BorderThickness="1"
+                            Grid.ColumnSpan="4"
+                            Margin="0,-1,0,0"
                             BorderBrush="{DynamicResource ThemeBorderHighBrush}"
+                            BorderThickness="1"
                             CornerRadius=".5" />
-                    <Rectangle Grid.ColumnSpan="4"
-                               Grid.RowSpan="1"
-                               StrokeThickness="1"
+                    <Rectangle Grid.RowSpan="1"
+                               Grid.ColumnSpan="4"
+                               Fill="{DynamicResource ThemeAccentBrush}"
                                Stroke="{DynamicResource ThemeBorderHighBrush}"
-                               Fill="{DynamicResource ThemeAccentBrush}">
-                    </Rectangle>
-                    <TextBlock Margin="0,-1,0,0"
-                               VerticalAlignment="Center"
-                               HorizontalAlignment="Center"
+                               StrokeThickness="1" />
+                    <TextBlock Grid.Row="1"
+                               Grid.RowSpan="3"
                                Grid.Column="0"
-                               Grid.Row="1"
                                Grid.ColumnSpan="4"
-                               Grid.RowSpan="3"
+                               Margin="0,-1,0,0"
+                               HorizontalAlignment="Center"
+                               VerticalAlignment="Center"
                                FontSize="{DynamicResource FontSizeSmall}"
                                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>
                 </ControlTemplate>
               </Setter>
             </Style>
 
             <Style Selector="Button.CalendarDropDown /template/ Border#Highlight">
-              <Setter Property="IsVisible" Value="False"/>
+              <Setter Property="IsVisible" Value="False" />
             </Style>
             <Style Selector="Button.CalendarDropDown:pressed /template/ Border#Highlight">
-              <Setter Property="IsVisible" Value="True"/>
+              <Setter Property="IsVisible" Value="True" />
             </Style>
 
             <Style Selector="Button.CalendarDropDown:pointerover /template/ Border#Background">
-              <Setter Property="Background" Value="{DynamicResource ThemeAccentBrush4}"/>
+              <Setter Property="Background" Value="{DynamicResource ThemeAccentBrush4}" />
             </Style>
-            
+
           </Grid.Styles>
-          
+
           <TextBox Name="PART_TextBox"
-                   Background="{TemplateBinding Background}" 
-                   BorderBrush="{TemplateBinding BorderBrush}" 
+                   Grid.Column="0"
+                   Padding="{TemplateBinding Padding}"
+                   HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
+                   VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
+                   Background="{TemplateBinding Background}"
+                   BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    CornerRadius="{TemplateBinding CornerRadius}"
-                   Padding="{TemplateBinding Padding}"
-                   Watermark="{TemplateBinding Watermark}"
-                   UseFloatingWatermark="{TemplateBinding UseFloatingWatermark}"
                    DataValidationErrors.Errors="{TemplateBinding (DataValidationErrors.Errors)}"
-                   VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
-                   HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
-                   Grid.Column="0"/>
+                   UseFloatingWatermark="{TemplateBinding UseFloatingWatermark}"
+                   Watermark="{TemplateBinding Watermark}" />
 
           <Button Name="PART_Button"
                   Grid.Column="1"
                   Width="20"
-                  Classes="CalendarDropDown"
-                  Foreground="{TemplateBinding Foreground}"
-                  Background="Transparent"
-                  BorderThickness="0"
                   Margin="2,0,2,0"
                   Padding="0"
+                  Background="Transparent"
+                  BorderThickness="0"
+                  Classes="CalendarDropDown"
                   ClipToBounds="False"
-                  Focusable="False"/>
+                  Focusable="False"
+                  Foreground="{TemplateBinding Foreground}" />
 
           <Popup Name="PART_Popup"
                  PlacementTarget="{TemplateBinding}"
                  StaysOpen="False">
             <Calendar Name="PART_Calendar"
-                      FirstDayOfWeek="{TemplateBinding FirstDayOfWeek}"
-                      IsTodayHighlighted="{TemplateBinding IsTodayHighlighted}"
-                      SelectedDate="{TemplateBinding SelectedDate, Mode=TwoWay}"
                       DisplayDate="{TemplateBinding DisplayDate}"
+                      DisplayDateEnd="{TemplateBinding DisplayDateEnd}"
                       DisplayDateStart="{TemplateBinding DisplayDateStart}"
-                      DisplayDateEnd="{TemplateBinding DisplayDateEnd}" />
+                      FirstDayOfWeek="{TemplateBinding FirstDayOfWeek}"
+                      IsTodayHighlighted="{TemplateBinding IsTodayHighlighted}"
+                      SelectedDate="{TemplateBinding SelectedDate,
+                                                     Mode=TwoWay}" />
           </Popup>
         </Grid>
       </ControlTemplate>
     </Setter>
-  </Style>
 
-  <Style Selector="CalendarDatePicker:focus /template/ TextBox#PART_TextBox">
-    <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderHighBrush}"/>
-  </Style>
-  
-</Styles>
+    <Style Selector="^:focus /template/ TextBox#PART_TextBox">
+      <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderHighBrush}" />
+    </Style>
+  </ControlTheme>
+</ResourceDictionary>

+ 69 - 80
src/Avalonia.Themes.Default/Controls/CalendarDayButton.xaml

@@ -1,116 +1,105 @@
 <!--
-// (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.
+  // (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.
 -->
 
-<Styles xmlns="https://github.com/avaloniaui">
-  <Style Selector="CalendarDayButton">
+<ResourceDictionary xmlns="https://github.com/avaloniaui"
+                    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="Foreground" Value="{DynamicResource ThemeForegroundBrush}" />
     <Setter Property="FontSize" Value="{DynamicResource FontSizeSmall}" />
     <Setter Property="HorizontalContentAlignment" Value="Center" />
     <Setter Property="VerticalContentAlignment" Value="Center" />
     <Setter Property="MinWidth" Value="5" />
     <Setter Property="MinHeight" Value="5" />
-    <Setter Property="Focusable" Value="False"/>
+    <Setter Property="Focusable" Value="False" />
     <Setter Property="Template">
       <ControlTemplate>
         <Panel Background="Transparent">
 
           <Rectangle Name="TodayBackground"
-                     Fill="{DynamicResource HighlightBrush}"/>
+                     Fill="{DynamicResource HighlightBrush}"
+                     IsVisible="False" />
 
           <Rectangle Name="SelectedBackground"
-                     Opacity="0.75"
-                     Fill="{TemplateBinding Background}"/>
+                     Fill="{TemplateBinding Background}"
+                     IsVisible="False"
+                     Opacity="0.75" />
 
           <Rectangle Name="Background"
-                     Opacity="0.5"
-                     Fill="{TemplateBinding Background}"/>
+                     Fill="{TemplateBinding Background}"
+                     IsVisible="False"
+                     Opacity="0.5" />
 
           <ContentControl Name="Content"
-                          ContentTemplate="{TemplateBinding ContentTemplate}"
-                          Content="{TemplateBinding Content}"
+                          Margin="5,1,5,1"
                           HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                           VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
+                          Content="{TemplateBinding Content}"
+                          ContentTemplate="{TemplateBinding ContentTemplate}"
                           FontSize="{TemplateBinding FontSize}"
-                          Margin="5,1,5,1"/>
+                          Foreground="{TemplateBinding Foreground}"
+                          Opacity="1" />
 
           <Path Name="BlackoutVisual"
                 Margin="3"
                 HorizontalAlignment="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}"
-                Stretch="Fill"
-                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" />
-          
+                IsVisible="False"
+                RenderTransformOrigin="0.5,0.5"
+                Stretch="Fill" />
+
           <Rectangle Name="FocusVisual"
-                     StrokeThickness="1"
+                     IsHitTestVisible="False"
+                     IsVisible="False"
                      Stroke="{DynamicResource HighlightBrush}"
-                     IsHitTestVisible="False"/>
+                     StrokeThickness="1" />
 
         </Panel>
       </ControlTemplate>
     </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>

+ 67 - 72
src/Avalonia.Themes.Default/Controls/CalendarItem.xaml

@@ -1,26 +1,27 @@
 <!--
-// (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.
+  // (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.
 -->
 
-<Styles xmlns="https://github.com/avaloniaui"
-        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
-  <Style Selector="CalendarItem">
+<ResourceDictionary xmlns="https://github.com/avaloniaui"
+                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+  <ControlTheme x:Key="{x:Type CalendarItem}"
+                TargetType="CalendarItem">
     <Setter Property="CornerRadius" Value="1" />
     <Setter Property="Template">
       <ControlTemplate>
         <Panel>
-          <Border BorderThickness="{TemplateBinding BorderThickness}"
-                  CornerRadius="{TemplateBinding CornerRadius}"
-                  BorderBrush="{TemplateBinding BorderBrush}"
+          <Border Margin="0,2,0,2"
                   Background="{TemplateBinding Background}"
-                  Margin="0,2,0,2">
+                  BorderBrush="{TemplateBinding BorderBrush}"
+                  BorderThickness="{TemplateBinding BorderThickness}"
+                  CornerRadius="{TemplateBinding CornerRadius}">
 
-            <Border CornerRadius="1"
-                    BorderBrush="{DynamicResource ThemeBackgroundBrush}"
-                    BorderThickness="2">
+            <Border BorderBrush="{DynamicResource ThemeBackgroundBrush}"
+                    BorderThickness="2"
+                    CornerRadius="1">
               <Grid>
                 <Grid.RowDefinitions>
                   <RowDefinition Height="Auto" />
@@ -34,81 +35,81 @@
 
                 <Grid.Styles>
                   <Style Selector="Button.CalendarHeader">
-                    <Setter Property="Cursor" Value="Hand"/>
-                    <Setter Property="Background" Value="Transparent"/>
-                    <Setter Property="BorderThickness" Value="0"/>
+                    <Setter Property="Cursor" Value="Hand" />
+                    <Setter Property="Background" Value="Transparent" />
+                    <Setter Property="BorderThickness" Value="0" />
                   </Style>
-                    <Style Selector="Button.CalendarHeader:pressed  /template/ ContentPresenter">
-                    <Setter Property="Background" Value="Transparent"/>
+                  <Style Selector="Button.CalendarHeader:pressed  /template/ ContentPresenter">
+                    <Setter Property="Background" Value="Transparent" />
                   </Style>
 
                   <Style Selector="Button.CalendarNavigation">
-                    <Setter Property="Height" Value="20"/>
-                    <Setter Property="Width" Value="28"/>
+                    <Setter Property="Height" Value="20" />
+                    <Setter Property="Width" Value="28" />
                   </Style>
                   <Style Selector="Button.CalendarNavigation > Path">
-                    <Setter Property="Fill" Value="{DynamicResource ThemeForegroundBrush}"/>
+                    <Setter Property="Fill" Value="{DynamicResource ThemeForegroundBrush}" />
                   </Style>
                   <Style Selector="Button.CalendarNavigation:pointerover > Path">
-                    <Setter Property="Fill" Value="{DynamicResource HighlightBrush}"/>
+                    <Setter Property="Fill" Value="{DynamicResource HighlightBrush}" />
                   </Style>
 
                   <Style Selector="Button#HeaderButton:pointerover">
-                    <Setter Property="Foreground" Value="{DynamicResource HighlightBrush}"/>
+                    <Setter Property="Foreground" Value="{DynamicResource HighlightBrush}" />
                   </Style>
                 </Grid.Styles>
 
                 <Rectangle Grid.ColumnSpan="3"
-                           Fill="{TemplateBinding HeaderBackground}"
-                           Stretch="Fill"
+                           Height="22"
                            VerticalAlignment="Top"
-                           Height="22"/>
+                           Fill="{TemplateBinding HeaderBackground}"
+                           Stretch="Fill" />
 
                 <Button Name="PreviousButton"
+                        HorizontalAlignment="Left"
                         Classes="CalendarHeader CalendarNavigation"
-                        IsVisible="False"
-                        HorizontalAlignment="Left">
+                        IsVisible="False">
 
-                  <Path Margin="14,-6,0,0"
+                  <Path Width="6"
                         Height="10"
-                        Width="6"
-                        VerticalAlignment="Center"
+                        Margin="14,-6,0,0"
                         HorizontalAlignment="Left"
-                        Stretch="Fill"
-                        Data="M288.75,232.25 L288.75,240.625 L283,236.625 z" />
-                  
+                        VerticalAlignment="Center"
+                        Data="M288.75,232.25 L288.75,240.625 L283,236.625 z"
+                        Stretch="Fill" />
+
                 </Button>
-                
+
                 <Button Name="HeaderButton"
-                        Classes="CalendarHeader"
                         Grid.Column="1"
-                        FontWeight="Bold"
-                        FontSize="10.5"
+                        Padding="1,5,1,9"
                         HorizontalAlignment="Center"
-                        VerticalAlignment="Center" 
-                        Padding="1,5,1,9"/>
+                        VerticalAlignment="Center"
+                        Classes="CalendarHeader"
+                        FontSize="10.5"
+                        FontWeight="Bold" />
 
                 <Button Name="NextButton"
-                        Classes="CalendarHeader CalendarNavigation"
                         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"
-                        Width="6"
-                        Stretch="Fill"
-                        VerticalAlignment="Center"
+                        Margin="0,-6,14,0"
                         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>
 
                 <Grid Name="MonthView"
                       Grid.Row="1"
                       Grid.ColumnSpan="3"
-                      IsVisible="False"
-                      Margin="6,-1,6,6">
+                      Margin="6,-1,6,6"
+                      IsVisible="False">
                   <Grid.RowDefinitions>
                     <RowDefinition Height="Auto" />
                     <RowDefinition Height="Auto" />
@@ -132,8 +133,8 @@
                 <Grid Name="YearView"
                       Grid.Row="1"
                       Grid.ColumnSpan="3"
-                      IsVisible="False"
-                      Margin="6,-3,7,6">
+                      Margin="6,-3,7,6"
+                      IsVisible="False">
                   <Grid.RowDefinitions>
                     <RowDefinition Height="Auto" />
                     <RowDefinition Height="Auto" />
@@ -146,39 +147,33 @@
                     <ColumnDefinition Width="Auto" />
                   </Grid.ColumnDefinitions>
                 </Grid>
-
               </Grid>
             </Border>
           </Border>
 
-
           <Rectangle Name="DisabledVisual"
-                     Stretch="Fill"
+                     Margin="0,2,0,2"
                      Fill="{DynamicResource ThemeControlLowBrush}"
+                     IsVisible="False"
                      Opacity="{DynamicResource ThemeDisabledOpacity}"
-                     Margin="0,2,0,2" />
+                     Stretch="Fill" />
 
         </Panel>
       </ControlTemplate>
     </Setter>
     <Setter Property="DayTitleTemplate">
       <Template>
-        <TextBlock FontWeight="Bold"
-                   FontSize="9.5"
-                   Margin="0,4,0,4"
+        <TextBlock Margin="0,4,0,4"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center"
+                   FontSize="9.5"
+                   FontWeight="Bold"
                    Text="{Binding}" />
       </Template>
-
     </Setter>
-  </Style>
-
-  <Style Selector="CalendarItem /template/ Rectangle#DisabledVisual">
-    <Setter Property="IsVisible" Value="False"/>
-  </Style>
-  <Style Selector="CalendarItem:calendardisabled /template/ Rectangle#DisabledVisual">
-    <Setter Property="IsVisible" Value="True"/>
-  </Style>
-  
-</Styles>
+
+    <Style Selector="^:calendardisabled /template/ Rectangle#DisabledVisual">
+      <Setter Property="IsVisible" Value="True" />
+    </Style>
+  </ControlTheme>
+</ResourceDictionary>

+ 93 - 60
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">
-  <Style Selector="CaptionButtons">
-    <Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}"/>    
+<ResourceDictionary xmlns="https://github.com/avaloniaui"
+                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+  <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="Template">
       <ControlTemplate>
-        <StackPanel Spacing="2" VerticalAlignment="Stretch" TextElement.FontSize="10" Orientation="Horizontal">
-          <StackPanel.Styles>
-            <Style Selector="Panel">
-              <Setter Property="Width" Value="45" />
-              <Setter Property="Background" Value="Transparent" />
-            </Style>
-            <Style Selector="Panel:pointerover">
-              <Setter Property="Background" Value="#7F7f7f7f" />
-            </Style>
-            <Style Selector="Panel#PART_CloseButton:pointerover">
-              <Setter Property="Background" Value="#7FFF0000" />
-            </Style>
-            <Style Selector="Viewbox">
-              <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}" />
+        <StackPanel VerticalAlignment="Stretch"
+                    Orientation="Horizontal"
+                    Spacing="2"
+                    TextElement.FontSize="10">
+          <Button x:Name="PART_FullScreenButton"
+                  IsVisible="False"
+                  Theme="{StaticResource DefaultCaptionButton}">
+            <Viewbox Width="11"
+                     Margin="2">
+              <Path Name="FullScreenButtonPath"
+                    Data="M2048 2048v-819h-205v469l-1493 -1493h469v-205h-819v819h205v-469l1493 1493h-469v205h819z"
+                    Fill="{TemplateBinding Foreground}"
+                    Stretch="UniformToFill" />
             </Viewbox>
-          </Panel>
-
-          <Panel x:Name="PART_MinimiseButton">
-            <Viewbox>
-              <Path Stretch="UniformToFill" Fill="{TemplateBinding Foreground}" Data="M2048 1229v-205h-2048v205h2048z" />
+          </Button>
+          <Button x:Name="PART_MinimiseButton"
+                  Theme="{StaticResource DefaultCaptionButton}">
+            <Viewbox Width="11"
+                     Margin="2">
+              <Path Data="M2048 1229v-205h-2048v205h2048z"
+                    Fill="{TemplateBinding Foreground}"
+                    Stretch="UniformToFill" />
             </Viewbox>
-          </Panel>
-
-          <Panel x:Name="PART_RestoreButton">
-            <Viewbox>
+          </Button>
+          <Button x:Name="PART_RestoreButton"
+                  Theme="{StaticResource DefaultCaptionButton}">
+            <Viewbox Width="11"
+                     Margin="2">
               <Viewbox.RenderTransform>
                 <RotateTransform Angle="-90" />
               </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>
-          </Panel>
-
-          <Panel x:Name="PART_CloseButton">
-            <Viewbox>
-              <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" />
+          </Button>
+          <Button x:Name="PART_CloseButton"
+                  Background="#ffe81123"
+                  BorderBrush="#fff1707a"
+                  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>
-          </Panel>
+          </Button>
         </StackPanel>
       </ControlTemplate>
     </Setter>
-  </Style>
-  <Style Selector="CaptionButtons Panel#PART_RestoreButton Path">
-    <Setter Property="Data" Value="M2048 2048v-2048h-2048v2048h2048zM1843 1843h-1638v-1638h1638v1638z" />
-  </Style>
-  <Style Selector="CaptionButtons:maximized Panel#PART_RestoreButton Path">
-    <Setter Property="Data" Value="M2048 410h-410v-410h-1638v1638h410v410h1638v-1638zM1434 1434h-1229v-1229h1229v1229zM1843 1843h-1229v-205h1024v-1024h205v1229z" />
-  </Style>
-  <Style Selector="CaptionButtons Panel#PART_FullScreenButton">
-    <Setter Property="IsVisible" Value="False" />
-  </Style>
-  <Style Selector="CaptionButtons Panel#PART_FullScreenButton Path">
-    <Setter Property="Data" Value="M2048 2048v-819h-205v469l-1493 -1493h469v-205h-819v819h205v-469l1493 1493h-469v205h819z" />
-  </Style>
-  <Style Selector="CaptionButtons:fullscreen Panel#PART_FullScreenButton Path">
-    <Setter Property="IsVisible" Value="True" />
-    <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>
+    <Style Selector="^:maximized /template/ Path#RestoreButtonPath">
+      <Setter Property="Data" Value="M2048 410h-410v-410h-1638v1638h410v410h1638v-1638zM1434 1434h-1229v-1229h1229v1229zM1843 1843h-1229v-205h1024v-1024h205v1229z" />
+    </Style>
+    <Style Selector="^:fullscreen /template/ Path#PART_FullScreenButtonPath">
+      <Setter Property="IsVisible" Value="True" />
+      <Setter Property="Data" Value="M205 1024h819v-819h-205v469l-674 -674l-145 145l674 674h-469v205zM1374 1229h469v-205h-819v819h205v-469l674 674l145 -145z" />
+    </Style>
+    <Style Selector="^:fullscreen /template/ Panel#PART_RestoreButton">
+      <Setter Property="IsVisible" Value="False" />
+    </Style>
+    <Style Selector="^:fullscreen /template/ Panel#PART_MinimiseButton">
+      <Setter Property="IsVisible" Value="False" />
+    </Style>
+  </ControlTheme>
+</ResourceDictionary>

+ 21 - 17
src/Avalonia.Themes.Default/Controls/Carousel.xaml

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

+ 49 - 46
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">
-  <Style Selector="CheckBox">
-    <Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}"/>
-    <Setter Property="Background" Value="Transparent"/>
-    <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/>
-    <Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}"/>
-    <Setter Property="Padding" Value="4,0,0,0"/>
-    <Setter Property="VerticalContentAlignment" Value="Center"/>
-    <Setter Property="HorizontalContentAlignment" Value="Left"/>
+<ResourceDictionary xmlns="https://github.com/avaloniaui"
+                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+  <ControlTheme x:Key="{x:Type CheckBox}"
+                TargetType="CheckBox">
+    <Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" />
+    <Setter Property="Background" Value="Transparent" />
+    <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" />
+    <Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}" />
+    <Setter Property="Padding" Value="4,0,0,0" />
+    <Setter Property="VerticalContentAlignment" Value="Center" />
+    <Setter Property="HorizontalContentAlignment" Value="Left" />
     <Setter Property="Template">
       <ControlTemplate>
         <Grid ColumnDefinitions="Auto,*">
           <Border Name="border"
+                  Width="18"
+                  Height="18"
+                  VerticalAlignment="Center"
                   Background="{TemplateBinding Background}"
                   BorderBrush="{TemplateBinding BorderBrush}"
                   BorderThickness="{TemplateBinding BorderThickness}"
-                  CornerRadius="{TemplateBinding CornerRadius}"
-                  Width="18"
-                  Height="18"
-                  VerticalAlignment="Center">
+                  CornerRadius="{TemplateBinding CornerRadius}">
             <Panel>
               <Path Name="checkMark"
-                    Fill="{DynamicResource HighlightBrush}"
                     Width="11"
                     Height="10"
-                    Stretch="Uniform"
                     HorizontalAlignment="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"
-                    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"
-                         Fill="{DynamicResource HighlightBrush}"
                          Width="10"
                          Height="10"
-                         Stretch="Uniform"
                          HorizontalAlignment="Center"
-                         VerticalAlignment="Center"/>
+                         VerticalAlignment="Center"
+                         Fill="{DynamicResource HighlightBrush}"
+                         Stretch="Uniform" />
             </Panel>
           </Border>
           <ContentPresenter Name="PART_ContentPresenter"
-                            TextElement.Foreground="{TemplateBinding Foreground}"
-                            ContentTemplate="{TemplateBinding ContentTemplate}"
-                            Content="{TemplateBinding Content}"
+                            Grid.Column="1"
                             Margin="{TemplateBinding Padding}"
-                            RecognizesAccessKey="True"
-                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                             HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
-                            IsVisible="{TemplateBinding Content, Converter={x:Static ObjectConverters.IsNotNull}}"
-                            Grid.Column="1"/>
+                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
+                            Content="{TemplateBinding Content}"
+                            ContentTemplate="{TemplateBinding ContentTemplate}"
+                            IsVisible="{TemplateBinding Content,
+                                                        Converter={x:Static ObjectConverters.IsNotNull}}"
+                            RecognizesAccessKey="True"
+                            TextElement.Foreground="{TemplateBinding Foreground}" />
         </Grid>
       </ControlTemplate>
     </Setter>
-  </Style>
-  <Style Selector="CheckBox:pointerover /template/ Border#border">
-    <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderHighBrush}"/>
-  </Style>
-  <Style Selector="CheckBox /template/ Path#checkMark">
-    <Setter Property="IsVisible" Value="False"/>
-  </Style>
-  <Style Selector="CheckBox /template/ Rectangle#indeterminateMark">
-    <Setter Property="IsVisible" Value="False"/>
-  </Style>
-  <Style Selector="CheckBox:checked /template/ Path#checkMark">
-    <Setter Property="IsVisible" Value="True"/>
-  </Style>
-  <Style Selector="CheckBox:indeterminate /template/ Rectangle#indeterminateMark">
-    <Setter Property="IsVisible" Value="True"/>
-  </Style>
-  <Style Selector="CheckBox:disabled /template/ Border#border">
-    <Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}"/>
-  </Style>
-</Styles>
+    <Style Selector="^:pointerover /template/ Border#border">
+      <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderHighBrush}" />
+    </Style>
+    <Style Selector="^ /template/ Path#checkMark">
+      <Setter Property="IsVisible" Value="False" />
+    </Style>
+    <Style Selector="^ /template/ Rectangle#indeterminateMark">
+      <Setter Property="IsVisible" Value="False" />
+    </Style>
+    <Style Selector="^:checked /template/ Path#checkMark">
+      <Setter Property="IsVisible" Value="True" />
+    </Style>
+    <Style Selector="^:indeterminate /template/ Rectangle#indeterminateMark">
+      <Setter Property="IsVisible" Value="True" />
+    </Style>
+    <Style Selector="^:disabled /template/ Border#border">
+      <Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
+    </Style>
+  </ControlTheme>
+</ResourceDictionary>

+ 34 - 47
src/Avalonia.Themes.Default/Controls/ComboBox.xaml

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

+ 30 - 33
src/Avalonia.Themes.Default/Controls/ComboBoxItem.xaml

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

+ 20 - 16
src/Avalonia.Themes.Default/Controls/ContentControl.xaml

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

+ 25 - 21
src/Avalonia.Themes.Default/Controls/ContextMenu.xaml

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

+ 48 - 43
src/Avalonia.Themes.Default/Controls/DataValidationErrors.xaml

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

+ 236 - 260
src/Avalonia.Themes.Default/Controls/DatePicker.xaml

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

+ 139 - 0
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>

+ 36 - 34
src/Avalonia.Themes.Default/Controls/DropDownButton.xaml

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

+ 24 - 19
src/Avalonia.Themes.Default/Controls/EmbeddableControlRoot.xaml

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

+ 221 - 161
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>
     <Border Padding="20">
-      <StackPanel Orientation="Vertical" Spacing="20" Width="350">
-        <Expander ExpandDirection="Up" Header="Expand Up" CornerRadius="25">
+      <StackPanel Width="350"
+                  Orientation="Vertical"
+                  Spacing="20">
+        <Expander CornerRadius="25"
+                  ExpandDirection="Up">
           <Expander.Header>
             <Grid ColumnDefinitions="*, Auto">
-              <TextBlock Grid.Column="0" Text="Expand" />
-              <TextBlock Grid.Column="1" Text="Up" />
+              <TextBlock Grid.Column="0"
+                         Text="Expand" />
+              <TextBlock Grid.Column="1"
+                         Text="Up" />
             </Grid>
           </Expander.Header>
           <StackPanel>
-            <TextBlock>Expanded content</TextBlock>
+            <TextBlock Text="Expanded content" />
           </StackPanel>
         </Expander>
-        <Expander ExpandDirection="Down" Header="Expand Down" CornerRadius="25">
+        <Expander CornerRadius="25"
+                  ExpandDirection="Down"
+                  Header="Expand Down">
           <StackPanel>
-            <TextBlock>Expanded content</TextBlock>
+            <TextBlock Text="Expanded content" />
           </StackPanel>
         </Expander>
-        <Expander ExpandDirection="Left" Header="Expand Left" CornerRadius="25">
+        <Expander CornerRadius="25"
+                  ExpandDirection="Left"
+                  Header="Expand Left">
           <StackPanel>
-            <TextBlock>Expanded content</TextBlock>
+            <TextBlock Text="Expanded content" />
           </StackPanel>
         </Expander>
-        <Expander ExpandDirection="Right" Header="Expand Right" CornerRadius="25">
+        <Expander CornerRadius="25"
+                  ExpandDirection="Right"
+                  Header="Expand Right">
           <StackPanel>
-            <TextBlock>Expanded content</TextBlock>
+            <TextBlock Text="Expanded content" />
           </StackPanel>
         </Expander>
       </StackPanel>
     </Border>
   </Design.PreviewWith>
-  <Style Selector="Expander">
-    <Setter Property="ContentTransition">
-      <Setter.Value>
-        <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">
+
+  <ControlTheme x:Key="DefaultExpanderToggleButtonTheme"
+                TargetType="ToggleButton">
     <Setter Property="HorizontalContentAlignment" Value="Stretch" />
     <Setter Property="Background" Value="Transparent" />
     <Setter Property="Template">
       <ControlTemplate>
-        <Border BorderThickness="1" Background="{TemplateBinding Background}">
+        <Border Background="{TemplateBinding Background}"
+                BorderThickness="1">
           <Grid ColumnDefinitions="Auto,*">
-            <Border Grid.Column="0" Width="20" Height="20" HorizontalAlignment="Center" VerticalAlignment="Center">
-              <Path Fill="{DynamicResource ThemeForegroundBrush}"
-                      HorizontalAlignment="Center"
-                      VerticalAlignment="Center"
-                      Data="M 0 2 L 4 6 L 0 10 Z" />
+            <Border Grid.Column="0"
+                    Width="20"
+                    Height="20"
+                    HorizontalAlignment="Center"
+                    VerticalAlignment="Center">
+              <Path HorizontalAlignment="Center"
+                    VerticalAlignment="Center"
+                    Data="M 0 2 L 4 6 L 0 10 Z"
+                    Fill="{DynamicResource ThemeForegroundBrush}" />
             </Border>
             <ContentPresenter Name="PART_ContentPresenter"
-                              Grid.Column="1" 
-                              Background="Transparent" 
-                              Content="{TemplateBinding Content}" 
-                              ContentTemplate="{Binding $parent[Expander].HeaderTemplate}"
-                              VerticalAlignment="Center" 
+                              Grid.Column="1"
+                              Padding="{TemplateBinding Padding}"
+                              VerticalAlignment="Center"
                               HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                               VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
-                              Padding="{TemplateBinding Padding}"/>
+                              Background="Transparent"
+                              Content="{TemplateBinding Content}"
+                              ContentTemplate="{Binding $parent[Expander].HeaderTemplate}" />
           </Grid>
         </Border>
       </ControlTemplate>
     </Setter>
-  </Style>
-  <Style Selector="Expander /template/ ToggleButton#PART_toggle:pointerover /template/ Border">
-    <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderLowBrush}" />
-  </Style>
-  <Style Selector="Expander:down:expanded /template/ ToggleButton#PART_toggle /template/ Path">
-    <Setter Property="RenderTransform">
-      <RotateTransform Angle="90" />
-    </Setter>
-  </Style>
-  <Style Selector="Expander:up:expanded /template/ ToggleButton#PART_toggle /template/ Path">
-    <Setter Property="RenderTransform">
-      <RotateTransform Angle="-90" />
-    </Setter>
-  </Style>
-  <Style Selector="Expander:left:expanded /template/ ToggleButton#PART_toggle /template/ Path">
-    <Setter Property="RenderTransform">
-      <RotateTransform Angle="180" />
-    </Setter>
-  </Style>
-  <Style Selector="Expander:right /template/ ToggleButton#PART_toggle /template/ Path">
-    <Setter Property="RenderTransform">
-      <RotateTransform Angle="180" />
-    </Setter>
-  </Style>
-  <Style Selector="Expander:right:expanded /template/ ToggleButton#PART_toggle /template/ Path">
-    <Setter Property="RenderTransform">
-      <RotateTransform Angle="0" />
+    <Style Selector="^:pointerover /template/ Border">
+      <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderLowBrush}" />
+    </Style>
+  </ControlTheme>
+  <ControlTheme x:Key="DefaultExpanderToggleButtonUpTheme"
+                BasedOn="{StaticResource DefaultExpanderToggleButtonTheme}"
+                TargetType="ToggleButton">
+    <Style Selector="^ /template/ Path">
+      <Setter Property="RenderTransform">
+        <RotateTransform Angle="-90" />
+      </Setter>
+    </Style>
+  </ControlTheme>
+  <ControlTheme x:Key="DefaultExpanderToggleButtonDownTheme"
+                BasedOn="{StaticResource DefaultExpanderToggleButtonTheme}"
+                TargetType="ToggleButton">
+    <Style Selector="^ /template/ Path">
+      <Setter Property="RenderTransform">
+        <RotateTransform Angle="90" />
+      </Setter>
+    </Style>
+  </ControlTheme>
+  <ControlTheme x:Key="DefaultExpanderToggleButtonLeftTheme"
+                BasedOn="{StaticResource DefaultExpanderToggleButtonTheme}"
+                TargetType="ToggleButton">
+    <Style Selector="^ /template/ Path">
+      <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>
-  </Style>
-</Styles>
+    <Style Selector="^[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}"
+                            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>

+ 11 - 9
src/Avalonia.Themes.Default/Controls/FlyoutPresenter.xaml

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

+ 5 - 4
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">
     <FocusAdornerTemplate>
-      <Rectangle Stroke="Black"
-                 StrokeThickness="1"
+      <Rectangle Margin="1"
+                 Stroke="Black"
                  StrokeDashArray="1,2"
-                 Margin="1"/>
+                 StrokeThickness="1" />
     </FocusAdornerTemplate>
   </Setter>
 </Style>

+ 10 - 11
src/Avalonia.Themes.Default/Controls/GridSplitter.xaml

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

+ 20 - 16
src/Avalonia.Themes.Default/Controls/ItemsControl.xaml

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

+ 22 - 18
src/Avalonia.Themes.Default/Controls/Label.xaml

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

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

+ 34 - 32
src/Avalonia.Themes.Default/Controls/ListBoxItem.xaml

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

+ 181 - 138
src/Avalonia.Themes.Default/Controls/ManagedFileChooser.xaml

@@ -1,153 +1,196 @@
-<Styles xmlns="https://github.com/avaloniaui"
-        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-        xmlns:dialogs="clr-namespace:Avalonia.Dialogs;assembly=Avalonia.Dialogs">
-  <Style Selector="dialogs|ManagedFileChooser">
-    <Style.Resources>
-        <ResourceDictionary>
-            <DrawingGroup x:Key="LevelUp">
-                <GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" />
-                <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" />
-                <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="#FFF0EFF1" Geometry="F1M8.0001,1.9996L7.5001,3.0006 14.0001,3.0006 14.0001,1.9996z" />
-            </DrawingGroup>
-            <dialogs:ResourceSelectorConverter x:Key="Icons">
-                <DrawingGroup x:Key="Icon_Folder">
-                    <GeometryDrawing Brush="#00FFFFFF" Geometry="F1M0,0L16,0 16,16 0,16z" />
-                    <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" />
-                    <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="#FFEFEFF0" Geometry="F1M2,3L8.374,3 8.874,4 2,4z" />
-                </DrawingGroup>
-                <DrawingGroup x:Key="Icon_File">
-                    <GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" />
-                    <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="#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="#FFF0EFF1" Geometry="F1M4,3L9,3 9,6 12,6 12,13 4,13z" />
-                </DrawingGroup>
-                <DrawingGroup x:Key="Icon_Volume">
-                    <GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" />
-                    <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" />
-                    <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" />
-                    <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>
-        </ResourceDictionary>
-    </Style.Resources>
+<ResourceDictionary xmlns="https://github.com/avaloniaui"
+                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+                    xmlns:dialogs="clr-namespace:Avalonia.Dialogs;assembly=Avalonia.Dialogs">
+  <DrawingGroup x:Key="LevelUp">
+    <GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" />
+    <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" />
+    <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="#FFF0EFF1" Geometry="F1M8.0001,1.9996L7.5001,3.0006 14.0001,3.0006 14.0001,1.9996z" />
+  </DrawingGroup>
+  <dialogs:ResourceSelectorConverter x:Key="Icons">
+    <DrawingGroup x:Key="Icon_Folder">
+      <GeometryDrawing Brush="#00FFFFFF" Geometry="F1M0,0L16,0 16,16 0,16z" />
+      <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" />
+      <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="#FFEFEFF0" Geometry="F1M2,3L8.374,3 8.874,4 2,4z" />
+    </DrawingGroup>
+    <DrawingGroup x:Key="Icon_File">
+      <GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" />
+      <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="#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="#FFF0EFF1" Geometry="F1M4,3L9,3 9,6 12,6 12,13 4,13z" />
+    </DrawingGroup>
+    <DrawingGroup x:Key="Icon_Volume">
+      <GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" />
+      <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" />
+      <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" />
+      <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">
       <ControlTemplate>
         <DockPanel>
-          <DockPanel DockPanel.Dock="Top" Margin="0 0 0 5">
-              <dialogs:ChildFitter DockPanel.Dock="Right" Width="{Binding ElementName=Location, Path=Bounds.Height}">
-                  <Button Command="{Binding GoUp}">
-                      <DrawingPresenter Drawing="{StaticResource LevelUp}" Stretch="Fill"/>
-                  </Button>
-              </dialogs:ChildFitter>
-              <TextBox x:Name="Location" Text="{Binding Location}" Margin="0 0 5 0">
-                  <TextBox.KeyBindings>
-                      <KeyBinding Command="{Binding EnterPressed}" Gesture="Enter"/>
-                  </TextBox.KeyBindings>
-              </TextBox>
+          <DockPanel Margin="0,0,0,5"
+                     DockPanel.Dock="Top">
+            <dialogs:ChildFitter Width="{Binding ElementName=Location, Path=Bounds.Height}"
+                                 DockPanel.Dock="Right">
+              <Button Command="{Binding GoUp}">
+                <Image Stretch="Fill">
+                  <DrawingImage Drawing="{StaticResource LevelUp}" />
+                </Image>
+              </Button>
+            </dialogs:ChildFitter>
+            <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 Margin="0 5 0 0"  DockPanel.Dock="Bottom">
-              <StackPanel Orientation="Horizontal" DockPanel.Dock="Left">
-                  <CheckBox IsChecked="{Binding ShowHiddenFiles}">
-                      <TextBlock>Show hidden files</TextBlock>
-                  </CheckBox>
-              </StackPanel>
-              <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Spacing="10">
-                  <StackPanel.Styles>
-                      <Style Selector="Button">
-                          <Setter Property="Margin" Value="4"/>
-                      </Style>
-                  </StackPanel.Styles>
-                  <Button Command="{Binding Ok}">OK</Button>
-                  <Button Command="{Binding Cancel}">Cancel</Button>
-              </StackPanel>
+          <DockPanel Margin="0,5,0,0"
+                     DockPanel.Dock="Bottom">
+            <StackPanel DockPanel.Dock="Left"
+                        Orientation="Horizontal">
+              <CheckBox IsChecked="{Binding ShowHiddenFiles}">
+                <TextBlock>Show hidden files</TextBlock>
+              </CheckBox>
+            </StackPanel>
+            <StackPanel HorizontalAlignment="Right"
+                        Orientation="Horizontal"
+                        Spacing="10">
+              <StackPanel.Styles>
+                <Style Selector="Button">
+                  <Setter Property="Margin" Value="4" />
+                </Style>
+              </StackPanel.Styles>
+              <Button Command="{Binding Ok}">OK</Button>
+              <Button Command="{Binding Cancel}">Cancel</Button>
+            </StackPanel>
           </DockPanel>
 
-          <ComboBox DockPanel.Dock="Bottom" 
-                    IsVisible="{Binding ShowFilters}" 
+          <ComboBox Margin="0,5,0,0"
+                    DockPanel.Dock="Bottom"
+                    IsVisible="{Binding ShowFilters}"
                     Items="{Binding Filters}"
-                    SelectedItem="{Binding SelectedFilter}"
-                    Margin="0 5 0 0" />
+                    SelectedItem="{Binding SelectedFilter}" />
 
-          <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}"
-                  SelectedIndex="{Binding QuickLinksSelectedIndex}"
-                  DockPanel.Dock="Left" Focusable="False">
-              <ListBox.ItemTemplate>
-                  <DataTemplate>
-                      <StackPanel Spacing="4" Orientation="Horizontal" Background="Transparent">
-                          <DrawingPresenter Width="16" Height="16" Drawing="{Binding IconKey, Converter={StaticResource Icons}}"/>
-                          <TextBlock Text="{Binding DisplayName}"/>
-                      </StackPanel>
-                  </DataTemplate>
-              </ListBox.ItemTemplate>
+          <ListBox x:Name="QuickLinks"
+                   Margin="0,0,5,5"
+                   BorderBrush="Transparent"
+                   DockPanel.Dock="Left"
+                   Focusable="False"
+                   Items="{Binding QuickLinks}"
+                   SelectedIndex="{Binding QuickLinksSelectedIndex}">
+            <ListBox.ItemTemplate>
+              <DataTemplate>
+                <StackPanel Background="Transparent"
+                            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>
           <DockPanel Grid.IsSharedSizeScope="True">
-              <Grid DockPanel.Dock="Top" Margin="15 5 0 0" HorizontalAlignment="Stretch">
-                  <Grid.ColumnDefinitions>
-                      <ColumnDefinition Width="20" SharedSizeGroup="Icon" />
-                      <ColumnDefinition Width="16" SharedSizeGroup="Splitter"  />
-                      <ColumnDefinition Width="400" SharedSizeGroup="Name" />
-                      <ColumnDefinition Width="16" SharedSizeGroup="Splitter" />
-                      <ColumnDefinition Width="200" SharedSizeGroup="Modified" />
-                      <ColumnDefinition Width="16" SharedSizeGroup="Splitter" />
-                      <ColumnDefinition Width="150" SharedSizeGroup="Type" />
-                      <ColumnDefinition Width="16" SharedSizeGroup="Splitter" />
-                      <ColumnDefinition Width="200" SharedSizeGroup="Size" />
-                  </Grid.ColumnDefinitions>
-                  <GridSplitter Grid.Column="1" />
-                  <TextBlock Grid.Column="2" Text="Name" />
-                  <GridSplitter Grid.Column="3" />
-                  <TextBlock Grid.Column="4" Text="Date Modified" />
-                  <GridSplitter Grid.Column="5" />
-                  <TextBlock Grid.Column="6" Text="Type" />
-                  <GridSplitter Grid.Column="7" />
-                  <TextBlock Grid.Column="8" Text="Size" />
-              </Grid>
-              <ListBox x:Name="Files"
-                  VirtualizationMode="Simple"
-                  Items="{Binding Items}"
-                  Margin="0 5"
-                  SelectionMode="{Binding SelectionMode}"
-                  SelectedItems="{Binding SelectedItems}"
-                  ScrollViewer.HorizontalScrollBarVisibility="Disabled">
-                  <ListBox.ItemTemplate>
-                      <DataTemplate>
-                          <Grid Background="Transparent">
-                              <Grid.ColumnDefinitions>
-                                  <ColumnDefinition SharedSizeGroup="Icon" />
-                                  <ColumnDefinition SharedSizeGroup="Splitter"  />
-                                  <ColumnDefinition SharedSizeGroup="Name" />
-                                  <ColumnDefinition SharedSizeGroup="Splitter" />
-                                  <ColumnDefinition SharedSizeGroup="Modified" />
-                                  <ColumnDefinition SharedSizeGroup="Splitter" />
-                                  <ColumnDefinition SharedSizeGroup="Type" />
-                                  <ColumnDefinition SharedSizeGroup="Splitter" />
-                                  <ColumnDefinition SharedSizeGroup="Size" />
-                              </Grid.ColumnDefinitions>
-                              <DrawingPresenter Width="16" Height="16" Drawing="{Binding IconKey, Converter={StaticResource Icons}}"/>
-                              <TextBlock Grid.Column="2" Text="{Binding DisplayName}"/>
-                              <TextBlock Grid.Column="4" Text="{Binding Modified}" />
-                              <TextBlock Grid.Column="6" 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>
+            <Grid Margin="15,5,0,0"
+                  HorizontalAlignment="Stretch"
+                  DockPanel.Dock="Top">
+              <Grid.ColumnDefinitions>
+                <ColumnDefinition Width="20" SharedSizeGroup="Icon" />
+                <ColumnDefinition Width="16" SharedSizeGroup="Splitter" />
+                <ColumnDefinition Width="400" SharedSizeGroup="Name" />
+                <ColumnDefinition Width="16" SharedSizeGroup="Splitter" />
+                <ColumnDefinition Width="200" SharedSizeGroup="Modified" />
+                <ColumnDefinition Width="16" SharedSizeGroup="Splitter" />
+                <ColumnDefinition Width="150" SharedSizeGroup="Type" />
+                <ColumnDefinition Width="16" SharedSizeGroup="Splitter" />
+                <ColumnDefinition Width="200" SharedSizeGroup="Size" />
+              </Grid.ColumnDefinitions>
+              <GridSplitter Grid.Column="1" />
+              <TextBlock Grid.Column="2"
+                         Text="Name" />
+              <GridSplitter Grid.Column="3" />
+              <TextBlock Grid.Column="4"
+                         Text="Date Modified" />
+              <GridSplitter Grid.Column="5" />
+              <TextBlock Grid.Column="6"
+                         Text="Type" />
+              <GridSplitter Grid.Column="7" />
+              <TextBlock Grid.Column="8"
+                         Text="Size" />
+            </Grid>
+            <ListBox x:Name="Files"
+                     Margin="0,5"
+                     Items="{Binding Items}"
+                     ScrollViewer.HorizontalScrollBarVisibility="Disabled"
+                     SelectedItems="{Binding SelectedItems}"
+                     SelectionMode="{Binding SelectionMode}"
+                     VirtualizationMode="Simple">
+              <ListBox.ItemTemplate>
+                <DataTemplate>
+                  <Grid Background="Transparent">
+                    <Grid.ColumnDefinitions>
+                      <ColumnDefinition SharedSizeGroup="Icon" />
+                      <ColumnDefinition SharedSizeGroup="Splitter" />
+                      <ColumnDefinition SharedSizeGroup="Name" />
+                      <ColumnDefinition SharedSizeGroup="Splitter" />
+                      <ColumnDefinition SharedSizeGroup="Modified" />
+                      <ColumnDefinition SharedSizeGroup="Splitter" />
+                      <ColumnDefinition SharedSizeGroup="Type" />
+                      <ColumnDefinition SharedSizeGroup="Splitter" />
+                      <ColumnDefinition SharedSizeGroup="Size" />
+                    </Grid.ColumnDefinitions>
+                    <Image Grid.Column="0"
+                           Width="16"
+                           Height="16">
+                      <DrawingImage Drawing="{Binding IconKey, Converter={StaticResource Icons}}" />
+                    </Image>
+                    <TextBlock Grid.Column="2"
+                               Text="{Binding DisplayName}" />
+                    <TextBlock Grid.Column="4"
+                               Text="{Binding Modified}" />
+                    <TextBlock Grid.Column="6"
+                               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>
       </ControlTemplate>
     </Setter>
-  </Style>
-</Styles>
+  </ControlTheme>
+</ResourceDictionary>

+ 83 - 17
src/Avalonia.Themes.Default/Controls/Menu.xaml

@@ -1,17 +1,83 @@
-<Style xmlns="https://github.com/avaloniaui" Selector="Menu">
-  <Setter Property="Template">
-    <ControlTemplate>
-      <Border Background="{TemplateBinding Background}"
-              BorderBrush="{TemplateBinding BorderBrush}"
-              BorderThickness="{TemplateBinding BorderThickness}"
-              CornerRadius="{TemplateBinding CornerRadius}"
-              Padding="{TemplateBinding Padding}">
-        <ItemsPresenter Name="PART_ItemsPresenter" 
-                        Items="{TemplateBinding Items}" 
-                        ItemsPanel="{TemplateBinding ItemsPanel}"
-                        ItemTemplate="{TemplateBinding ItemTemplate}"
-                        KeyboardNavigation.TabNavigation="Continue"/>
-      </Border>
-    </ControlTemplate>
-  </Setter>
-</Style>
+<ResourceDictionary xmlns="https://github.com/avaloniaui"
+                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+                    xmlns:sys="using:System">
+
+  <ControlTheme x:Key="DefaultTopLevelMenuItem"
+                TargetType="MenuItem">
+    <Setter Property="Background" Value="Transparent" />
+    <Setter Property="Padding" Value="6 0" />
+    <Setter Property="BorderThickness" Value="1" />
+    <Setter Property="Template">
+      <ControlTemplate>
+        <Border Name="root"
+                Background="{TemplateBinding Background}"
+                BorderBrush="{TemplateBinding BorderBrush}"
+                BorderThickness="{TemplateBinding BorderThickness}"
+                CornerRadius="{TemplateBinding CornerRadius}">
+          <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>

+ 12 - 9
src/Avalonia.Themes.Default/Controls/MenuFlyoutPresenter.xaml

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

+ 60 - 103
src/Avalonia.Themes.Default/Controls/MenuItem.xaml

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

+ 30 - 30
src/Avalonia.Themes.Default/Controls/NativeMenuBar.xaml

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

+ 88 - 83
src/Avalonia.Themes.Default/Controls/NotificationCard.xaml

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

+ 24 - 25
src/Avalonia.Themes.Default/Controls/NumericUpDown.xaml

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

+ 25 - 23
src/Avalonia.Themes.Default/Controls/OverlayPopupHost.xaml

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

+ 11 - 10
src/Avalonia.Themes.Default/Controls/PathIcon.xaml

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

+ 30 - 27
src/Avalonia.Themes.Default/Controls/PopupRoot.xaml

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

+ 86 - 69
src/Avalonia.Themes.Default/Controls/ProgressBar.xaml

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

+ 45 - 42
src/Avalonia.Themes.Default/Controls/RadioButton.xaml

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

+ 32 - 39
src/Avalonia.Themes.Default/Controls/RepeatButton.xaml

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

+ 11 - 7
src/Avalonia.Themes.Default/Controls/RichTextBlock.xaml

@@ -1,10 +1,14 @@
-<Styles xmlns="https://github.com/avaloniaui"
-        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
-    <Design.PreviewWith>
-        <RichTextBlock IsTextSelectionEnabled="True" Text="Preview"/>
-    </Design.PreviewWith>
+<ResourceDictionary xmlns="https://github.com/avaloniaui"
+                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+  <Design.PreviewWith>
+    <RichTextBlock IsTextSelectionEnabled="True"
+                   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" />
     </Style>
-</Styles>
+  </ControlTheme>
+</ResourceDictionary>

+ 146 - 137
src/Avalonia.Themes.Default/Controls/ScrollBar.xaml

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

+ 76 - 57
src/Avalonia.Themes.Default/Controls/ScrollViewer.xaml

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

+ 13 - 15
src/Avalonia.Themes.Default/Controls/Separator.xaml

@@ -1,21 +1,19 @@
-<Styles xmlns="https://github.com/avaloniaui">
-
-  <Style Selector="Separator">
-    <Setter Property="Focusable" Value="False"/>
+<ResourceDictionary xmlns="https://github.com/avaloniaui"
+                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+  <ControlTheme x:Key="{x:Type Separator}"
+                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">
       <ControlTemplate>
-        <Border BorderBrush="{TemplateBinding BorderBrush}"
+        <Border Background="{TemplateBinding Background}"
+                BorderBrush="{TemplateBinding BorderBrush}"
                 BorderThickness="{TemplateBinding BorderThickness}"
-                CornerRadius="{TemplateBinding CornerRadius}"
-                Background="{TemplateBinding Background}"/>
+                CornerRadius="{TemplateBinding CornerRadius}" />
       </ControlTemplate>
     </Setter>
-  </Style>
-
-  <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>
+  </ControlTheme>
 
-</Styles>
+</ResourceDictionary>

+ 122 - 91
src/Avalonia.Themes.Default/Controls/Slider.xaml

@@ -1,97 +1,128 @@
-<Styles xmlns="https://github.com/avaloniaui">
-  <Style Selector="Slider:horizontal">
-    <Setter Property="MinWidth" Value="40"/>
-    <Setter Property="MinHeight" Value="20"/>
+<ResourceDictionary xmlns="https://github.com/avaloniaui"
+                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+  <ControlTheme x:Key="SliderRepeatTrackTheme"
+                TargetType="RepeatButton">
+    <Setter Property="Background" Value="Transparent" />
+    <Setter Property="Focusable" Value="False" />
+    <Setter Property="Foreground" Value="{DynamicResource ThemeBorderLowBrush}" />
     <Setter Property="Template">
       <ControlTemplate>
-        <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"
-                             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>
+        <Border Background="{TemplateBinding Background}" />
       </ControlTemplate>
     </Setter>
-  </Style>
-  <Style Selector="Slider:vertical">
-    <Setter Property="MinWidth" Value="20"/>
-    <Setter Property="MinHeight" Value="40"/>
-    <Setter Property="Template">
-      <ControlTemplate>
-        <Grid>
-          <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"
-                             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">
+  </ControlTheme>
+
+  <ControlTheme x:Key="{x:Type Slider}"
+                TargetType="Slider">
+    <Style Selector="^:horizontal">
+      <Setter Property="MinWidth" Value="40" />
+      <Setter Property="MinHeight" Value="20" />
+      <Setter Property="Template">
         <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>
-    </Setter>
-  </Style>
-  <Style Selector="Slider /template/ TickBar">
-    <Setter Property="Ticks" Value="{TemplateBinding Ticks}" />
-  </Style>
-  <Style Selector="Slider:disabled /template/ Grid#grid">
-    <Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
-  </Style>
-</Styles>
+      </Setter>
+    </Style>
+    <Style Selector="^:vertical">
+      <Setter Property="MinWidth" Value="20" />
+      <Setter Property="MinHeight" Value="40" />
+      <Setter Property="Template">
+        <ControlTemplate>
+          <Grid>
+            <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>

+ 196 - 248
src/Avalonia.Themes.Default/Controls/SplitButton.xaml

@@ -1,9 +1,9 @@
-<Styles xmlns="https://github.com/avaloniaui"
-        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-        x:CompileBindings="True"
-        xmlns:converters="using:Avalonia.Controls.Converters">
+<ResourceDictionary xmlns="https://github.com/avaloniaui"
+                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+                    x:CompileBindings="True"
+                    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. -->
 
   <Design.PreviewWith>
@@ -12,50 +12,127 @@
     </Border>
   </Design.PreviewWith>
 
-  <Styles.Resources>
-    <x:Double x:Key="SplitButtonPrimaryButtonSize">24</x:Double>
-    <x:Double x:Key="SplitButtonSecondaryButtonSize">24</x:Double>
-    <x:Double x:Key="SplitButtonSeparatorWidth">1</x:Double>
-    <x:Double x:Key="SplitButtonMinHeight">24</x:Double>
-    <Thickness x:Key="SplitButtonBorderThemeThickness">1</Thickness>
-
-    <converters:MarginMultiplierConverter x:Key="PrimaryButtonBorderMultiplier" Left="True" Top="True" Bottom="True" Indent="1" />
-    <converters:MarginMultiplierConverter x:Key="SecondaryButtonBorderMultiplier" Right="True" Top="True" Bottom="True" Indent="1" />
-    <converters:MarginMultiplierConverter x:Key="SeparatorBorderMultiplier" Top="True" Bottom="True" Indent="1" />
-    <converters:CornerRadiusFilterConverter x:Key="TopCornerRadiusFilterConverter" Filter="TopLeft, TopRight"/>
-    <converters:CornerRadiusFilterConverter x:Key="RightCornerRadiusFilterConverter" Filter="TopRight, BottomRight"/>
-    <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="SplitButtonBackgroundPressed" Color="{DynamicResource ThemeBorderHighColor}" />
-    <SolidColorBrush x:Key="SplitButtonBackgroundDisabled" Color="{DynamicResource ThemeControlMidColor}" Opacity="{DynamicResource ThemeDisabledOpacity}" />
-    <SolidColorBrush x:Key="SplitButtonBackgroundChecked" Color="{DynamicResource ThemeBorderHighColor}" />
-    <SolidColorBrush x:Key="SplitButtonBackgroundCheckedPointerOver" Color="{DynamicResource ThemeBorderHighColor}" />
-    <SolidColorBrush x:Key="SplitButtonBackgroundCheckedPressed" Color="{DynamicResource ThemeBorderHighColor}" />
-    <SolidColorBrush x:Key="SplitButtonBackgroundCheckedDisabled" Color="{DynamicResource ThemeControlHighColor}" Opacity="{DynamicResource ThemeDisabledOpacity}" />
-
-    <SolidColorBrush x:Key="SplitButtonForeground" Color="{DynamicResource ThemeForegroundColor}" />
-    <SolidColorBrush x:Key="SplitButtonForegroundPointerOver" Color="{DynamicResource ThemeForegroundColor}" />
-    <SolidColorBrush x:Key="SplitButtonForegroundPressed" Color="{DynamicResource ThemeForegroundColor}" />
-    <SolidColorBrush x:Key="SplitButtonForegroundDisabled" Color="{DynamicResource ThemeForegroundColor}" />
-    <SolidColorBrush x:Key="SplitButtonForegroundChecked" Color="{DynamicResource ThemeForegroundColor}" />
-    <SolidColorBrush x:Key="SplitButtonForegroundCheckedPointerOver" Color="{DynamicResource ThemeForegroundColor}" />
-    <SolidColorBrush x:Key="SplitButtonForegroundCheckedPressed" Color="{DynamicResource ThemeForegroundColor}" />
-    <SolidColorBrush x:Key="SplitButtonForegroundCheckedDisabled" Color="{DynamicResource ThemeForegroundColor}" />
-
-    <SolidColorBrush x:Key="SplitButtonBorderBrush" Color="{DynamicResource ThemeBorderLowColor}" />
-    <SolidColorBrush x:Key="SplitButtonBorderBrushPointerOver" Color="{DynamicResource ThemeBorderMidColor}" />
-    <SolidColorBrush x:Key="SplitButtonBorderBrushPressed" Color="{DynamicResource ThemeBorderLowColor}" />
-    <SolidColorBrush x:Key="SplitButtonBorderBrushDisabled" Color="{DynamicResource ThemeBorderLowColor}" />
-    <SolidColorBrush x:Key="SplitButtonBorderBrushChecked" Color="{DynamicResource ThemeBorderMidColor}" />
-    <SolidColorBrush x:Key="SplitButtonBorderBrushCheckedPointerOver" Color="{DynamicResource ThemeBorderMidColor}" />
-    <SolidColorBrush x:Key="SplitButtonBorderBrushCheckedPressed" Color="{DynamicResource ThemeControlHighColor}" />
-    <SolidColorBrush x:Key="SplitButtonBorderBrushCheckedDisabled" Color="{DynamicResource ThemeControlMidColor}" Opacity="{DynamicResource ThemeDisabledOpacity}" />
-  </Styles.Resources>
+  <x:Double x:Key="SplitButtonPrimaryButtonSize">24</x:Double>
+  <x:Double x:Key="SplitButtonSecondaryButtonSize">24</x:Double>
+  <x:Double x:Key="SplitButtonSeparatorWidth">1</x:Double>
+  <x:Double x:Key="SplitButtonMinHeight">24</x:Double>
+  <Thickness x:Key="SplitButtonBorderThemeThickness">1</Thickness>
+
+  <converters:MarginMultiplierConverter x:Key="PrimaryButtonBorderMultiplier" Left="True" Top="True" Bottom="True"
+                                        Indent="1" />
+  <converters:MarginMultiplierConverter x:Key="SecondaryButtonBorderMultiplier" Right="True" Top="True" Bottom="True"
+                                        Indent="1" />
+  <converters:MarginMultiplierConverter x:Key="SeparatorBorderMultiplier" Top="True" Bottom="True" Indent="1" />
+  <converters:CornerRadiusFilterConverter x:Key="TopCornerRadiusFilterConverter" Filter="TopLeft, TopRight" />
+  <converters:CornerRadiusFilterConverter x:Key="RightCornerRadiusFilterConverter" Filter="TopRight, BottomRight" />
+  <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="SplitButtonBackgroundPressed" Color="{DynamicResource ThemeBorderHighColor}" />
+  <SolidColorBrush x:Key="SplitButtonBackgroundDisabled" Color="{DynamicResource ThemeControlMidColor}"
+                   Opacity="{DynamicResource ThemeDisabledOpacity}" />
+  <SolidColorBrush x:Key="SplitButtonBackgroundChecked" Color="{DynamicResource ThemeBorderHighColor}" />
+  <SolidColorBrush x:Key="SplitButtonBackgroundCheckedPointerOver" Color="{DynamicResource ThemeBorderHighColor}" />
+  <SolidColorBrush x:Key="SplitButtonBackgroundCheckedPressed" Color="{DynamicResource ThemeBorderHighColor}" />
+  <SolidColorBrush x:Key="SplitButtonBackgroundCheckedDisabled" Color="{DynamicResource ThemeControlHighColor}"
+                   Opacity="{DynamicResource ThemeDisabledOpacity}" />
+
+  <SolidColorBrush x:Key="SplitButtonForeground" Color="{DynamicResource ThemeForegroundColor}" />
+  <SolidColorBrush x:Key="SplitButtonForegroundPointerOver" Color="{DynamicResource ThemeForegroundColor}" />
+  <SolidColorBrush x:Key="SplitButtonForegroundPressed" Color="{DynamicResource ThemeForegroundColor}" />
+  <SolidColorBrush x:Key="SplitButtonForegroundDisabled" Color="{DynamicResource ThemeForegroundColor}" />
+  <SolidColorBrush x:Key="SplitButtonForegroundChecked" Color="{DynamicResource ThemeForegroundColor}" />
+  <SolidColorBrush x:Key="SplitButtonForegroundCheckedPointerOver" Color="{DynamicResource ThemeForegroundColor}" />
+  <SolidColorBrush x:Key="SplitButtonForegroundCheckedPressed" Color="{DynamicResource ThemeForegroundColor}" />
+  <SolidColorBrush x:Key="SplitButtonForegroundCheckedDisabled" Color="{DynamicResource ThemeForegroundColor}" />
+
+  <SolidColorBrush x:Key="SplitButtonBorderBrush" Color="{DynamicResource ThemeBorderLowColor}" />
+  <SolidColorBrush x:Key="SplitButtonBorderBrushPointerOver" Color="{DynamicResource ThemeBorderMidColor}" />
+  <SolidColorBrush x:Key="SplitButtonBorderBrushPressed" Color="{DynamicResource ThemeBorderLowColor}" />
+  <SolidColorBrush x:Key="SplitButtonBorderBrushDisabled" Color="{DynamicResource ThemeBorderLowColor}" />
+  <SolidColorBrush x:Key="SplitButtonBorderBrushChecked" Color="{DynamicResource ThemeBorderMidColor}" />
+  <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="Foreground" Value="{DynamicResource SplitButtonForeground}" />
     <Setter Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrush}" />
@@ -65,211 +142,82 @@
     <Setter Property="VerticalAlignment" Value="Center" />
     <Setter Property="HorizontalContentAlignment" Value="Stretch" />
     <Setter Property="VerticalContentAlignment" Value="Center" />
-    <!--<Setter Property="UseSystemFocusVisuals" Value="True" />
-    <Setter Property="FocusVisualMargin" Value="-3" />-->
     <Setter Property="KeyboardNavigation.IsTabStop" Value="True" />
     <Setter Property="Focusable" Value="True" />
     <Setter Property="Padding" Value="4" />
-    <Setter Property="CornerRadius" Value="0" />
     <Setter Property="Template">
-      <Setter.Value>
-        <ControlTemplate>
-          <Grid>
-            <Grid.ColumnDefinitions>
-              <ColumnDefinition Width="*" />
-              <ColumnDefinition Width="Auto" />
-              <ColumnDefinition Width="Auto" />
-            </Grid.ColumnDefinitions>
-
-            <Button x:Name="PART_PrimaryButton"
-                    Grid.Column="0"
-                    MinWidth="{DynamicResource SplitButtonPrimaryButtonSize}"
-                    Foreground="{TemplateBinding Foreground}"
-                    Background="{TemplateBinding Background}"
-                    BorderThickness="{TemplateBinding BorderThickness, Converter={StaticResource PrimaryButtonBorderMultiplier}}"
-                    BorderBrush="{TemplateBinding BorderBrush}"
-                    Content="{TemplateBinding Content}"
-                    ContentTemplate="{TemplateBinding ContentTemplate}"
-                    Command="{TemplateBinding Command}"
-                    CommandParameter="{TemplateBinding CommandParameter}"
-                    FontFamily="{TemplateBinding FontFamily}"
-                    FontSize="{TemplateBinding FontSize}"
-                    FontWeight="{TemplateBinding FontWeight}"
-                    HorizontalAlignment="Stretch"
-                    VerticalAlignment="Stretch"
-                    HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
-                    VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
-                    Padding="{TemplateBinding Padding}"
-                    Focusable="False"
-                    KeyboardNavigation.IsTabStop="False" />
-
-            <Border x:Name="SeparatorBorder"
-                    Grid.Column="1"
-                    Background="Transparent"
-                    Width="{DynamicResource SplitButtonSeparatorWidth}"
-                    BorderThickness="{TemplateBinding BorderThickness, Converter={StaticResource SeparatorBorderMultiplier}}"
-                    BorderBrush="{TemplateBinding BorderBrush}" />
-
-            <Button x:Name="PART_SecondaryButton"
-                    Grid.Column="2"
-                    MinWidth="{DynamicResource SplitButtonSecondaryButtonSize}"
-                    BorderBrush="{TemplateBinding BorderBrush}"
-                    Foreground="{TemplateBinding Foreground}"
-                    Background="{TemplateBinding Background}"
-                    BorderThickness="{TemplateBinding BorderThickness, Converter={StaticResource SecondaryButtonBorderMultiplier}}"
-                    Padding="0"
-                    HorizontalContentAlignment="Center"
-                    VerticalContentAlignment="Center"
-                    HorizontalAlignment="Stretch"
-                    VerticalAlignment="Stretch"
-                    Focusable="False"
-                    KeyboardNavigation.IsTabStop="False" />
-          </Grid>
-        </ControlTemplate>
-      </Setter.Value>
+      <ControlTemplate>
+        <Grid>
+          <Grid.ColumnDefinitions>
+            <ColumnDefinition Width="*" />
+            <ColumnDefinition Width="Auto" />
+            <ColumnDefinition Width="Auto" />
+          </Grid.ColumnDefinitions>
+
+          <Button x:Name="PART_PrimaryButton"
+                  Grid.Column="0"
+                  Theme="{StaticResource DefaultSplitButtonComponent}"
+                  MinWidth="{DynamicResource SplitButtonPrimaryButtonSize}"
+                  Foreground="{TemplateBinding Foreground}"
+                  Background="{TemplateBinding Background}"
+                  BorderThickness="{TemplateBinding BorderThickness, Converter={StaticResource PrimaryButtonBorderMultiplier}}"
+                  BorderBrush="{TemplateBinding BorderBrush}"
+                  Content="{TemplateBinding Content}"
+                  ContentTemplate="{TemplateBinding ContentTemplate}"
+                  Command="{TemplateBinding Command}"
+                  CommandParameter="{TemplateBinding CommandParameter}"
+                  CornerRadius="{TemplateBinding CornerRadius, Converter={StaticResource LeftCornerRadiusFilterConverter}}"
+                  FontFamily="{TemplateBinding FontFamily}"
+                  FontSize="{TemplateBinding FontSize}"
+                  FontWeight="{TemplateBinding FontWeight}"
+                  HorizontalAlignment="Stretch"
+                  VerticalAlignment="Stretch"
+                  HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
+                  VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
+                  Padding="{TemplateBinding Padding}"
+                  Focusable="False"
+                  KeyboardNavigation.IsTabStop="False" />
+
+          <Border x:Name="SeparatorBorder"
+                  Grid.Column="1"
+                  Background="Transparent"
+                  Width="{DynamicResource SplitButtonSeparatorWidth}"
+                  BorderThickness="{TemplateBinding BorderThickness, Converter={StaticResource SeparatorBorderMultiplier}}"
+                  BorderBrush="{TemplateBinding BorderBrush}" />
+
+          <Button x:Name="PART_SecondaryButton"
+                  Grid.Column="2"
+                  Theme="{StaticResource DefaultSplitButtonComponent}"
+                  MinWidth="{DynamicResource SplitButtonSecondaryButtonSize}"
+                  BorderBrush="{TemplateBinding BorderBrush}"
+                  Foreground="{TemplateBinding Foreground}"
+                  Background="{TemplateBinding Background}"
+                  BorderThickness="{TemplateBinding BorderThickness, Converter={StaticResource SecondaryButtonBorderMultiplier}}"
+                  CornerRadius="{TemplateBinding CornerRadius, Converter={StaticResource RightCornerRadiusFilterConverter}}"
+                  Padding="0"
+                  HorizontalContentAlignment="Center"
+                  VerticalContentAlignment="Center"
+                  HorizontalAlignment="Stretch"
+                  VerticalAlignment="Stretch"
+                  Focusable="False"
+                  KeyboardNavigation.IsTabStop="False">
+            <PathIcon Height="12" Width="12"
+                      Data="M1939 486L2029 576L1024 1581L19 576L109 486L1024 1401L1939 486Z" />
+          </Button>
+        </Grid>
+      </ControlTemplate>
     </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="SplitButton:pressed:checked /template/ Button#PART_PrimaryButton /template/ ContentPresenter,
-         SplitButton:pressed:checked /template/ Button#PART_SecondaryButton /template/ ContentPresenter,
-         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>
+    <Style Selector="^:flyout-open /template/ Button">
+      <Setter Property="Tag" Value="flyout-open" />
+    </Style>
 
-  <!-- Checked Flyout Open State -->
-  <Style Selector="SplitButton:checked:flyout-open /template/ Button#PART_PrimaryButton /template/ ContentPresenter,
-         SplitButton:checked:flyout-open /template/ Button#PART_SecondaryButton /template/ ContentPresenter,
-         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>
+    <Style Selector="^:checked /template/ Button">
+      <Setter Property="Tag" Value="checked" />
+    </Style>
 
-  <!-- Disabled Checked State -->
-  <Style Selector="SplitButton:checked:disabled /template/ Button#PART_PrimaryButton /template/ ContentPresenter,
-         SplitButton:checked:disabled /template/ Button#PART_SecondaryButton /template/ ContentPresenter,
-         SplitButton:checked:disabled /template/ Border#SeparatorBorder">
-    <Setter Property="Border.Background" Value="{DynamicResource SplitButtonBackgroundCheckedDisabled}" />
-    <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>
+    <Style Selector="^:checked:flyout-open /template/ Button">
+      <Setter Property="Tag" Value="checked-flyout-open" />
+    </Style>
+  </ControlTheme>
+</ResourceDictionary>

+ 236 - 215
src/Avalonia.Themes.Default/Controls/SplitView.xaml

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

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

+ 46 - 45
src/Avalonia.Themes.Default/Controls/TabItem.xaml

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

+ 8 - 9
src/Avalonia.Themes.Default/Controls/TabStrip.xaml

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

+ 18 - 15
src/Avalonia.Themes.Default/Controls/TabStripItem.xaml

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

+ 178 - 160
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">
-  <Styles.Resources>
-    <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="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>
+<ResourceDictionary xmlns="https://github.com/avaloniaui"
+                    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="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>
 
-    <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="TextBoxContextFlyoutCopyItem" Header="Copy" Command="{Binding $parent[TextBox].Copy}" 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>
+  <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="TextBoxContextFlyoutCopyItem" Header="Copy" Command="{Binding $parent[TextBox].Copy}"
+              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">
-      <MenuItem x:Name="TextBoxContextMenuCutItem" Header="Cut" Command="{Binding $parent[TextBox].Cut}" IsEnabled="{Binding $parent[TextBox].CanCut}" InputGesture="{x:Static TextBox.CutGesture}" />
-      <MenuItem x:Name="TextBoxContextMenuCopyItem" Header="Copy" Command="{Binding $parent[TextBox].Copy}" IsEnabled="{Binding $parent[TextBox].CanCopy}" InputGesture="{x:Static TextBox.CopyGesture}"/>
-      <MenuItem x:Name="TextBoxContextMenuPasteItem" Header="Paste" Command="{Binding $parent[TextBox].Paste}" IsEnabled="{Binding $parent[TextBox].CanPaste}" InputGesture="{x:Static TextBox.PasteGesture}"/>
-    </ContextMenu>
-  </Styles.Resources>
-  <Style Selector="TextBox">
+  <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="TextBoxContextMenuCopyItem" Header="Copy" Command="{Binding $parent[TextBox].Copy}"
+              IsEnabled="{Binding $parent[TextBox].CanCopy}" InputGesture="{x:Static TextBox.CopyGesture}" />
+    <MenuItem x:Name="TextBoxContextMenuPasteItem" Header="Paste" Command="{Binding $parent[TextBox].Paste}"
+              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="Background" Value="{DynamicResource ThemeBackgroundBrush}"/>
-    <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/>
-    <Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}"/>
-    <Setter Property="SelectionBrush" Value="{DynamicResource HighlightBrush}"/>
-    <Setter Property="SelectionForegroundBrush" Value="{DynamicResource HighlightForegroundBrush}"/>
-    <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="SelectionBrush" Value="{DynamicResource HighlightBrush}" />
+    <Setter Property="SelectionForegroundBrush" Value="{DynamicResource HighlightForegroundBrush}" />
+    <Setter Property="Padding" Value="4" />
     <Setter Property="ContextFlyout" Value="{StaticResource DefaultTextBoxContextFlyout}" />
     <Setter Property="ScrollViewer.IsScrollChainingEnabled" Value="True" />
     <Setter Property="Template">
@@ -38,17 +110,17 @@
                      VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
 
             <TextBlock Name="floatingWatermark"
-                       Foreground="{DynamicResource ThemeAccentBrush}"
+                       DockPanel.Dock="Top"
                        FontSize="{DynamicResource FontSizeSmall}"
-                       Text="{TemplateBinding Watermark}"
-                       DockPanel.Dock="Top">
+                       Foreground="{DynamicResource ThemeAccentBrush}"
+                       Text="{TemplateBinding Watermark}">
               <TextBlock.IsVisible>
                 <MultiBinding Converter="{x:Static BoolConverters.And}">
-                  <Binding RelativeSource="{RelativeSource TemplatedParent}"
-                           Path="UseFloatingWatermark"/>
-                  <Binding RelativeSource="{RelativeSource TemplatedParent}"
+                  <Binding Path="UseFloatingWatermark"
+                           RelativeSource="{RelativeSource TemplatedParent}" />
+                  <Binding Converter="{x:Static StringConverters.IsNotNullOrEmpty}"
                            Path="Text"
-                           Converter="{x:Static StringConverters.IsNotNullOrEmpty}"/>
+                           RelativeSource="{RelativeSource TemplatedParent}" />
                 </MultiBinding>
               </TextBlock.IsVisible>
             </TextBlock>
@@ -56,148 +128,94 @@
             <DataValidationErrors>
 
               <Grid ColumnDefinitions="Auto,*,Auto">
-                <ContentPresenter Grid.Column="0" Grid.ColumnSpan="1" Content="{TemplateBinding InnerLeftContent}"/>
-                <ScrollViewer Grid.Column="1" Grid.ColumnSpan="1"
+                <ContentPresenter Grid.Column="0"
+                                  Grid.ColumnSpan="1"
+                                  Content="{TemplateBinding InnerLeftContent}" />
+                <ScrollViewer Grid.Column="1"
+                              Grid.ColumnSpan="1"
+                              AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}"
                               HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
-                              VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}"
                               IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}"
-                              AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}">
+                              VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}">
                   <Panel>
                     <TextBlock Name="watermark"
-                              Opacity="0.5"
-                              Text="{TemplateBinding Watermark}"
-                              TextAlignment="{TemplateBinding TextAlignment}"
-                              TextWrapping="{TemplateBinding TextWrapping}"
-                              IsVisible="{TemplateBinding Text, Converter={x:Static StringConverters.IsNullOrEmpty}}"/>
+                               IsVisible="{TemplateBinding Text,
+                                                           Converter={x:Static StringConverters.IsNullOrEmpty}}"
+                               Opacity="0.5"
+                               Text="{TemplateBinding Watermark}"
+                               TextAlignment="{TemplateBinding TextAlignment}"
+                               TextWrapping="{TemplateBinding TextWrapping}" />
                     <TextPresenter Name="PART_TextPresenter"
-                                    Text="{TemplateBinding Text, Mode=TwoWay}"
-                                    CaretIndex="{TemplateBinding CaretIndex}"
-                                    SelectionStart="{TemplateBinding SelectionStart}"
-                                    SelectionEnd="{TemplateBinding SelectionEnd}"
-                                    TextAlignment="{TemplateBinding TextAlignment}"
-                                    TextWrapping="{TemplateBinding TextWrapping}"
-                                    LineHeight="{TemplateBinding LineHeight}"
-                                    PasswordChar="{TemplateBinding PasswordChar}"
-                                    RevealPassword="{TemplateBinding RevealPassword}"
-                                    SelectionBrush="{TemplateBinding SelectionBrush}"
-                                    SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}"
-                                    CaretBrush="{TemplateBinding CaretBrush}" />
+                                   CaretBrush="{TemplateBinding CaretBrush}"
+                                   CaretIndex="{TemplateBinding CaretIndex}"
+                                   LineHeight="{TemplateBinding LineHeight}"
+                                   PasswordChar="{TemplateBinding PasswordChar}"
+                                   RevealPassword="{TemplateBinding RevealPassword}"
+                                   SelectionBrush="{TemplateBinding SelectionBrush}"
+                                   SelectionEnd="{TemplateBinding SelectionEnd}"
+                                   SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}"
+                                   SelectionStart="{TemplateBinding SelectionStart}"
+                                   Text="{TemplateBinding Text,
+                                                          Mode=TwoWay}"
+                                   TextAlignment="{TemplateBinding TextAlignment}"
+                                   TextWrapping="{TemplateBinding TextWrapping}" />
                   </Panel>
                 </ScrollViewer>
-                <ContentPresenter Grid.Column="2" Grid.ColumnSpan="1" Content="{TemplateBinding InnerRightContent}"/>             
+                <ContentPresenter Grid.Column="2"
+                                  Grid.ColumnSpan="1"
+                                  Content="{TemplateBinding InnerRightContent}" />
               </Grid>
             </DataValidationErrors>
           </DockPanel>
         </Border>
       </ControlTemplate>
     </Setter>
-  </Style>
-  <Style Selector="TextBox:pointerover /template/ Border#border">
-    <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderHighBrush}"/>
-  </Style>
-  <Style Selector="TextBox:focus /template/ Border#border">
-    <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderHighBrush}"/>
-  </Style>
-  <Style Selector="TextBox:error /template/ Border#border">
-    <Setter Property="BorderBrush" Value="{DynamicResource ErrorBrush}"/>
-  </Style>
-  <Style Selector="TextBox /template/ DockPanel">
-    <Setter Property="Cursor" Value="IBeam" />
-  </Style>
-  <Style Selector="TextBox:disabled /template/ Border#border">
+
+    <Style Selector="^:pointerover /template/ Border#border">
+      <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderHighBrush}" />
+    </Style>
+    <Style Selector="^:focus /template/ Border#border">
+      <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderHighBrush}" />
+    </Style>
+    <Style Selector="^:error /template/ Border#border">
+      <Setter Property="BorderBrush" Value="{DynamicResource ErrorBrush}" />
+    </Style>
+    <Style Selector="^ /template/ DockPanel">
+      <Setter Property="Cursor" Value="IBeam" />
+    </Style>
+    <Style Selector="^:disabled /template/ Border#border">
       <Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
-  </Style>
-  
-  <Style Selector="TextBox.clearButton[AcceptsReturn=False][IsReadOnly=False]:focus:not(TextBox:empty)">
-    <Setter Property="InnerRightContent">
-      <Template>
-        <Button Classes="textBoxClearButton"
-                Command="{Binding $parent[TextBox].Clear}" />
-      </Template>
-    </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>
+
+    <Style Selector="^.clearButton[AcceptsReturn=False][IsReadOnly=False]:focus:not(TextBox:empty)">
+      <Setter Property="InnerRightContent">
+        <Template>
+          <Button Command="{Binding $parent[TextBox].Clear}"
+                  Focusable="False"
+                  Theme="{StaticResource DefaultTextBoxClearButtonTheme}" />
+        </Template>
+      </Setter>
+    </Style>
 
-  <Style Selector="Button.textBoxClearButton, ToggleButton.passwordBoxRevealButton">    
-    <Setter Property="Focusable" Value="False" />
-  </Style>
-</Styles>
+    <Style Selector="^.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 Background="Transparent"
+                          Focusable="False"
+                          IsChecked="{Binding $parent[TextBox].RevealPassword, Mode=TwoWay}"
+                          Theme="{StaticResource DefaultPasswordBoxRevealButtonTheme}" />
+          </Panel>
+        </Template>
+      </Setter>
+    </Style>
+  </ControlTheme>
+</ResourceDictionary>

+ 255 - 212
src/Avalonia.Themes.Default/Controls/TimePicker.xaml

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

+ 46 - 34
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>
     <Border>
-      <TitleBar Background="SkyBlue" Height="30" Width="300" Foreground="Black" />
+      <TitleBar Width="300"
+                Height="30"
+                Background="SkyBlue"
+                Foreground="Black" />
     </Border>
   </Design.PreviewWith>
-  <Style Selector="TitleBar">
-    <Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}"/>    
+  <ControlTheme x:Key="{x:Type TitleBar}"
+                TargetType="TitleBar">
+    <Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" />
     <Setter Property="VerticalAlignment" Value="Top" />
     <Setter Property="HorizontalAlignment" Value="Stretch" />
     <Setter Property="Background" Value="Transparent" />
     <Setter Property="Template">
       <ControlTemplate>
-        <Panel HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="Stretch">
-          <Panel x:Name="PART_MouseTracker" Height="1" VerticalAlignment="Top" />
+        <Panel HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
+               VerticalAlignment="Stretch">
+          <Panel x:Name="PART_MouseTracker"
+                 Height="1"
+                 VerticalAlignment="Top" />
           <Panel x:Name="PART_Container">
-            <Border x:Name="PART_Background" Background="{TemplateBinding Background}" />
-            <CaptionButtons x:Name="PART_CaptionButtons" VerticalAlignment="Top" HorizontalAlignment="Right" Foreground="{TemplateBinding Foreground}" />
+            <Border x:Name="PART_Background"
+                    Background="{TemplateBinding Background}" />
+            <CaptionButtons x:Name="PART_CaptionButtons"
+                            HorizontalAlignment="Right"
+                            VerticalAlignment="Top"
+                            Foreground="{TemplateBinding Foreground}" />
           </Panel>
         </Panel>
       </ControlTemplate>
     </Setter>
-  </Style>
+    <Style Selector="^:fullscreen">
+      <Setter Property="Background" Value="{DynamicResource ThemeAccentColor}" />
+    </Style>
 
-  <Style Selector="TitleBar:fullscreen">
-    <Setter Property="Background" Value="{DynamicResource ThemeAccentColor}" />
-  </Style>
+    <Style Selector="^ /template/ Border#PART_Background">
+      <Setter Property="IsHitTestVisible" Value="False" />
+    </Style>
 
-  <Style Selector="TitleBar /template/ Border#PART_Background">
-    <Setter Property="IsHitTestVisible" Value="False" />
-  </Style>
+    <Style Selector="^:fullscreen /template/ Border#PART_Background">
+      <Setter Property="IsHitTestVisible" Value="True" />
+    </Style>
 
-  <Style Selector="TitleBar:fullscreen /template/ Border#PART_Background">
-    <Setter Property="IsHitTestVisible" Value="True" />
-  </Style>
+    <Style Selector="^:fullscreen /template/ Panel#PART_MouseTracker">
+      <Setter Property="Background" Value="Transparent" />
+    </Style>
 
-  <Style Selector="TitleBar:fullscreen /template/ Panel#PART_MouseTracker">
-    <Setter Property="Background" Value="Transparent" />
-  </Style>
-
-  <Style Selector="TitleBar:fullscreen /template/ Panel#PART_Container">
-    <Setter Property="RenderTransform" Value="translateY(-30px)" />
-    <Setter Property="Transitions">
-      <Transitions>
-        <TransformOperationsTransition Property="RenderTransform" Duration="0:0:.25" />
-      </Transitions>
-    </Setter>
-  </Style>
+    <Style Selector="^:fullscreen /template/ Panel#PART_Container">
+      <Setter Property="RenderTransform" Value="translateY(-30px)" />
+      <Setter Property="Transitions">
+        <Transitions>
+          <TransformOperationsTransition Property="RenderTransform"
+                                         Duration="0:0:.25" />
+        </Transitions>
+      </Setter>
+    </Style>
 
-  <Style Selector="TitleBar:fullscreen:pointerover /template/ Panel#PART_Container">
-    <Setter Property="RenderTransform" Value="none" />
-  </Style>
-</Styles>
+    <Style Selector="^:fullscreen:pointerover /template/ Panel#PART_Container">
+      <Setter Property="RenderTransform" Value="none" />
+    </Style>
+  </ControlTheme>
+</ResourceDictionary>

+ 32 - 30
src/Avalonia.Themes.Default/Controls/ToggleButton.xaml

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

+ 231 - 252
src/Avalonia.Themes.Default/Controls/ToggleSwitch.xaml

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

+ 22 - 18
src/Avalonia.Themes.Default/Controls/ToolTip.xaml

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

+ 12 - 11
src/Avalonia.Themes.Default/Controls/TransitioningContentControl.xaml

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

+ 31 - 27
src/Avalonia.Themes.Default/Controls/TreeView.xaml

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

+ 83 - 76
src/Avalonia.Themes.Default/Controls/TreeViewItem.xaml

@@ -1,93 +1,100 @@
-<Styles xmlns="https://github.com/avaloniaui"
-        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-        xmlns:converters="clr-namespace:Avalonia.Controls.Converters;assembly=Avalonia.Controls">
-    <Style Selector="TreeViewItem">
-        <Style.Resources>
-            <converters:MarginMultiplierConverter Indent="16" Left="True" x:Key="LeftMarginConverter" />
-        </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>
+<ResourceDictionary xmlns="https://github.com/avaloniaui"
+                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+                    xmlns:converters="clr-namespace:Avalonia.Controls.Converters;assembly=Avalonia.Controls">
+  <converters:MarginMultiplierConverter x:Key="LeftMarginConverter"
+                                        Indent="16"
+                                        Left="True" />
 
-    <Style Selector="TreeViewItem /template/ ToggleButton#expander">
-        <Setter Property="Template">
-            <ControlTemplate>
-                <Border Background="Transparent"
-                        Width="14"
-                        Height="12"
-                        HorizontalAlignment="Center"
-                        VerticalAlignment="Center">
-                    <Path Fill="{DynamicResource ThemeForegroundBrush}"
-                          HorizontalAlignment="Center"
-                          VerticalAlignment="Center"
-                          Data="M 0 2 L 4 6 L 0 10 Z"/>
-                </Border>
-            </ControlTemplate>
-        </Setter>
-    </Style>
+  <ControlTheme x:Key="DefaultTreeViewItemToggleButtonTheme"
+                TargetType="ToggleButton">
+    <Setter Property="Template">
+      <ControlTemplate>
+        <Border Width="14"
+                Height="12"
+                HorizontalAlignment="Center"
+                VerticalAlignment="Center"
+                Background="Transparent">
+          <Path HorizontalAlignment="Center"
+                VerticalAlignment="Center"
+                Data="M 0 2 L 4 6 L 0 10 Z"
+                Fill="{DynamicResource ThemeForegroundBrush}" />
+        </Border>
+      </ControlTemplate>
+    </Setter>
 
-    <Style Selector="TreeViewItem /template/ ContentPresenter#PART_HeaderPresenter">
-        <Setter Property="Padding" Value="2"/>
+    <Style Selector="^:checked">
+      <Setter Property="RenderTransform">
+        <RotateTransform Angle="45" />
+      </Setter>
     </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">
-        <Setter Property="Background" Value="{DynamicResource ThemeControlHighlightMidBrush}"/>
+    <Style Selector="^ /template/ ContentPresenter#PART_HeaderPresenter">
+      <Setter Property="Padding" Value="2" />
     </Style>
 
-    <Style Selector="TreeViewItem:selected /template/ Border#SelectionBorder">
-        <Setter Property="Background" Value="{DynamicResource ThemeAccentBrush4}"/>
+    <Style Selector="^ /template/ Border#SelectionBorder:pointerover">
+      <Setter Property="Background" Value="{DynamicResource ThemeControlHighlightMidBrush}" />
     </Style>
 
-    <Style Selector="TreeViewItem:selected /template/ Border#SelectionBorder:focus">
-        <Setter Property="Background" Value="{DynamicResource ThemeAccentBrush3}"/>
+    <Style Selector="^:selected /template/ Border#SelectionBorder">
+      <Setter Property="Background" Value="{DynamicResource ThemeAccentBrush4}" />
     </Style>
 
-    <Style Selector="TreeViewItem:selected /template/ Border#SelectionBorder:pointerover">
-        <Setter Property="Background" Value="{DynamicResource ThemeAccentBrush3}"/>
+    <Style Selector="^:selected /template/ Border#SelectionBorder:focus">
+      <Setter Property="Background" Value="{DynamicResource ThemeAccentBrush3}" />
     </Style>
 
-    <Style Selector="TreeViewItem:selected /template/ Border#SelectionBorder:pointerover:focus">
-        <Setter Property="Background" Value="{DynamicResource ThemeAccentBrush2}"/>
+    <Style Selector="^:selected /template/ Border#SelectionBorder:pointerover">
+      <Setter Property="Background" Value="{DynamicResource ThemeAccentBrush3}" />
     </Style>
 
-    <Style Selector="TreeViewItem /template/ ToggleButton#expander:checked">
-        <Setter Property="RenderTransform">
-            <RotateTransform Angle="45"/>
-        </Setter>
+    <Style Selector="^:selected /template/ Border#SelectionBorder:pointerover:focus">
+      <Setter Property="Background" Value="{DynamicResource ThemeAccentBrush2}" />
     </Style>
 
-    <Style Selector="TreeViewItem:empty /template/ ToggleButton#expander">
-        <Setter Property="IsVisible" Value="False"/>
+    <Style Selector="^:empty /template/ ToggleButton#PART_ExpandCollapseChevron">
+      <Setter Property="IsVisible" Value="False" />
     </Style>
-</Styles>
+  </ControlTheme>
+</ResourceDictionary>

+ 24 - 15
src/Avalonia.Themes.Default/Controls/UserControl.xaml

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

+ 33 - 26
src/Avalonia.Themes.Default/Controls/Window.xaml

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

+ 44 - 37
src/Avalonia.Themes.Default/Controls/WindowNotificationManager.xaml

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

+ 74 - 69
src/Avalonia.Themes.Default/DefaultTheme.xaml

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

+ 2 - 2
src/Avalonia.Themes.Fluent/Controls/ContextMenu.xaml

@@ -29,7 +29,7 @@
     </Border>
   </Design.PreviewWith>
 
-  <!-- Added missing resource -->
+  <!--  Added missing resource  -->
   <Thickness x:Key="MenuFlyoutScrollerMargin">0,4,0,4</Thickness>
 
   <ControlTheme x:Key="{x:Type ContextMenu}" TargetType="ContextMenu">
@@ -54,7 +54,7 @@
                 MinHeight="{TemplateBinding MinHeight}"
                 HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                 CornerRadius="{TemplateBinding CornerRadius}">
-          <ScrollViewer Classes="menuscroller">
+          <ScrollViewer Theme="{StaticResource FluentMenuScrollViewer}">
             <ItemsPresenter Name="PART_ItemsPresenter"
                             Items="{TemplateBinding Items}"
                             ItemsPanel="{TemplateBinding ItemsPanel}"

+ 47 - 37
src/Avalonia.Themes.Fluent/Controls/DataValidationErrors.xaml

@@ -14,8 +14,7 @@
         <TextBox Text="Sample">
           <TextBox.Styles>
             <Style Selector="DataValidationErrors">
-              <Setter Property="Template" Value="{DynamicResource TooltipDataValidationContentTemplate}" />
-              <Setter Property="ErrorTemplate" Value="{DynamicResource TooltipDataValidationErrorTemplate}" />
+              <Setter Property="Theme" Value="{DynamicResource TooltipDataValidationErrors}" />
             </Style>
           </TextBox.Styles>
           <DataValidationErrors.Error>
@@ -26,10 +25,33 @@
     </Border>
   </Design.PreviewWith>
 
-  <ControlTheme x:Key="{x:Type DataValidationErrors}" TargetType="DataValidationErrors">
-    <ControlTheme.Resources>
-      <DataTemplate x:Key="InlineDataValidationErrorTemplate">
-        <ItemsControl Items="{Binding}" x:DataType="DataValidationErrors" Foreground="{DynamicResource SystemControlErrorTextForegroundBrush}">
+  <ControlTheme x:Key="{x:Type DataValidationErrors}"
+                TargetType="DataValidationErrors">
+    <Setter Property="Template">
+      <ControlTemplate TargetType="DataValidationErrors">
+        <DockPanel LastChildFill="True">
+          <ContentControl x:Name="InlineDataValidationContentControl"
+                          Margin="0,4,0,0"
+                          Content="{Binding (DataValidationErrors.Errors)}"
+                          ContentTemplate="{TemplateBinding ErrorTemplate}"
+                          DataContext="{TemplateBinding Owner}"
+                          DockPanel.Dock="Bottom"
+                          IsVisible="{Binding (DataValidationErrors.HasErrors)}" />
+          <ContentPresenter Name="PART_ContentPresenter"
+                            Padding="{TemplateBinding Padding}"
+                            Background="{TemplateBinding Background}"
+                            BorderThickness="{TemplateBinding BorderThickness}"
+                            Content="{TemplateBinding Content}"
+                            ContentTemplate="{TemplateBinding ContentTemplate}"
+                            CornerRadius="{TemplateBinding CornerRadius}" />
+        </DockPanel>
+      </ControlTemplate>
+    </Setter>
+    <Setter Property="ErrorTemplate">
+      <DataTemplate>
+        <ItemsControl x:DataType="DataValidationErrors"
+                      Foreground="{DynamicResource SystemControlErrorTextForegroundBrush}"
+                      Items="{Binding}">
           <ItemsControl.Styles>
             <Style Selector="TextBlock">
               <Setter Property="TextWrapping" Value="Wrap" />
@@ -37,27 +59,34 @@
           </ItemsControl.Styles>
         </ItemsControl>
       </DataTemplate>
-      <ControlTemplate x:Key="InlineDataValidationContentTemplate" TargetType="DataValidationErrors">
+    </Setter>
+  </ControlTheme>
+
+  <ControlTheme x:Key="TooltipDataValidationErrors"
+                TargetType="DataValidationErrors">
+    <Setter Property="Template">
+      <ControlTemplate TargetType="DataValidationErrors">
         <DockPanel LastChildFill="True">
-          <ContentControl x:Name="InlineDataValidationContentControl"
-                          Margin="0,4,0,0"
-                          Content="{Binding (DataValidationErrors.Errors)}"
+          <ContentControl Content="{Binding (DataValidationErrors.Errors)}"
                           ContentTemplate="{TemplateBinding ErrorTemplate}"
                           DataContext="{TemplateBinding Owner}"
-                          DockPanel.Dock="Bottom"
+                          DockPanel.Dock="Right"
                           IsVisible="{Binding (DataValidationErrors.HasErrors)}" />
           <ContentPresenter Name="PART_ContentPresenter"
                             Padding="{TemplateBinding Padding}"
                             Background="{TemplateBinding Background}"
+                            BorderBrush="{TemplateBinding BorderBrush}"
                             BorderThickness="{TemplateBinding BorderThickness}"
-                            CornerRadius="{TemplateBinding CornerRadius}"
                             Content="{TemplateBinding Content}"
-                            ContentTemplate="{TemplateBinding ContentTemplate}" />
+                            ContentTemplate="{TemplateBinding ContentTemplate}"
+                            CornerRadius="{TemplateBinding CornerRadius}" />
         </DockPanel>
       </ControlTemplate>
-
-      <DataTemplate x:DataType="DataValidationErrors" x:Key="TooltipDataValidationErrorTemplate">
-        <Panel Name="PART_InlineErrorTemplatePanel" Background="Transparent">
+    </Setter>
+    <Setter Property="ErrorTemplate">
+      <DataTemplate>
+        <Panel Name="PART_InlineErrorTemplatePanel"
+               Background="Transparent">
           <Panel.Styles>
             <Style Selector="Panel#PART_InlineErrorTemplatePanel">
               <Setter Property="Margin" Value="8,0" />
@@ -70,7 +99,7 @@
             </Style>
           </Panel.Styles>
           <ToolTip.Tip>
-            <ItemsControl Items="{Binding}" />
+            <ItemsControl Items="{ReflectionBinding}" />
           </ToolTip.Tip>
           <Path Width="14"
                 Height="14"
@@ -79,25 +108,6 @@
                 StrokeThickness="2" />
         </Panel>
       </DataTemplate>
-      <ControlTemplate x:Key="TooltipDataValidationContentTemplate" TargetType="DataValidationErrors">
-        <DockPanel LastChildFill="True">
-          <ContentControl Content="{Binding (DataValidationErrors.Errors)}"
-                          ContentTemplate="{TemplateBinding ErrorTemplate}"
-                          DataContext="{TemplateBinding Owner}"
-                          DockPanel.Dock="Right"
-                          IsVisible="{Binding (DataValidationErrors.HasErrors)}" />
-          <ContentPresenter Name="PART_ContentPresenter"
-                            Padding="{TemplateBinding Padding}"
-                            Background="{TemplateBinding Background}"
-                            BorderBrush="{TemplateBinding BorderBrush}"
-                            BorderThickness="{TemplateBinding BorderThickness}"
-                            CornerRadius="{TemplateBinding CornerRadius}"
-                            Content="{TemplateBinding Content}"
-                            ContentTemplate="{TemplateBinding ContentTemplate}" />
-        </DockPanel>
-      </ControlTemplate>
-    </ControlTheme.Resources>
-    <Setter Property="Template" Value="{StaticResource InlineDataValidationContentTemplate}" />
-    <Setter Property="ErrorTemplate" Value="{StaticResource InlineDataValidationErrorTemplate}" />
+    </Setter>
   </ControlTheme>
 </ResourceDictionary>

+ 0 - 1
src/Avalonia.Themes.Fluent/Controls/FluentControls.xaml

@@ -75,5 +75,4 @@
 
     <StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/FocusAdorner.xaml" />
     <StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/UserControl.xaml" />
-    <Styles.Resources />
 </Styles>

+ 3 - 3
src/Avalonia.Themes.Fluent/Controls/Menu.xaml

@@ -5,7 +5,7 @@
       <Menu>
         <MenuItem Header="_Standard" />
         <MenuItem Header="Selected" IsSelected="True" />
-        <MenuItem Header="Disabled" IsEnabled="False"/>
+        <MenuItem Header="Disabled" IsEnabled="False" />
       </Menu>
     </Border>
   </Design.PreviewWith>
@@ -46,7 +46,7 @@
                       MinHeight="{DynamicResource MenuFlyoutThemeMinHeight}"
                       HorizontalAlignment="Stretch"
                       CornerRadius="{DynamicResource OverlayCornerRadius}">
-                <ScrollViewer Classes="menuscroller">
+                <ScrollViewer Theme="{StaticResource FluentMenuScrollViewer}">
                   <ItemsPresenter Name="PART_ItemsPresenter"
                                   Items="{TemplateBinding Items}"
                                   ItemsPanel="{TemplateBinding ItemsPanel}"
@@ -91,7 +91,7 @@
   <ControlTheme x:Key="{x:Type Menu}" TargetType="Menu">
     <Setter Property="Background" Value="Transparent" />
     <Setter Property="Height" Value="{DynamicResource MenuBarHeight}" />
-    <Setter Property="ItemContainerTheme" Value="{StaticResource FluentTopLevelMenuItem}"/>
+    <Setter Property="ItemContainerTheme" Value="{StaticResource FluentTopLevelMenuItem}" />
     <Setter Property="Template">
       <ControlTemplate>
         <Border Background="{TemplateBinding Background}"

+ 1 - 0
src/Avalonia.Themes.Fluent/Controls/MenuFlyoutPresenter.xaml

@@ -19,6 +19,7 @@
                 Padding="{DynamicResource FlyoutBorderThemePadding}"
                 CornerRadius="{TemplateBinding CornerRadius}">
           <ScrollViewer HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
+                        Theme="{StaticResource FluentMenuScrollViewer}"
                         VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}">
             <ItemsPresenter Name="PART_ItemsPresenter"
                             Items="{TemplateBinding Items}"

+ 1 - 1
tests/Avalonia.Markup.Xaml.UnitTests/Xaml/BasicTests.cs

@@ -466,7 +466,7 @@ namespace Avalonia.Markup.Xaml.UnitTests.Xaml
                 var xaml = @"
 <Styles xmlns='https://github.com/avaloniaui'
         xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
-    <StyleInclude Source='avares://Avalonia.Themes.Default/Controls/ContextMenu.xaml'/>
+    <StyleInclude Source='avares://Avalonia.Themes.Default/Controls/UserControl.xaml'/>
 </Styles>";
 
                 var styles = AvaloniaRuntimeXamlLoader.Parse<Styles>(xaml);