Browse Source

Merge pull request #1136 from AvaloniaUI/dynamicresource-instead-of-styleresource

Use DynamicResource instead of StyleResource
pull/1155/head
Steven Kirk 9 years ago
committed by GitHub
parent
commit
f882c07e19
  1. 11
      docs/tutorial/from-wpf.md
  2. 10
      samples/ControlCatalog/Pages/BorderPage.xaml
  3. 8
      samples/ControlCatalog/Pages/ButtonPage.xaml
  4. 2
      samples/ControlCatalog/Pages/ContextMenuPage.xaml
  5. 2
      samples/ControlCatalog/Pages/DropDownPage.xaml
  6. 8
      samples/ControlCatalog/Pages/LayoutTransformControlPage.xaml
  7. 4
      samples/ControlCatalog/SideBar.xaml
  8. 2
      samples/RenderTest/Pages/ClippingPage.xaml
  9. 8
      samples/RenderTest/Pages/DrawingPage.xaml
  10. 4
      samples/RenderTest/SideBar.xaml
  11. 14
      src/Avalonia.Themes.Default/Button.xaml
  12. 10
      src/Avalonia.Themes.Default/CheckBox.xaml
  13. 10
      src/Avalonia.Themes.Default/DropDown.xaml
  14. 4
      src/Avalonia.Themes.Default/EmbeddableControlRoot.xaml
  15. 8
      src/Avalonia.Themes.Default/GridSplitter.xaml
  16. 6
      src/Avalonia.Themes.Default/ListBox.xaml
  17. 18
      src/Avalonia.Themes.Default/MenuItem.xaml
  18. 2
      src/Avalonia.Themes.Default/PopupRoot.xaml
  19. 4
      src/Avalonia.Themes.Default/ProgressBar.xaml
  20. 10
      src/Avalonia.Themes.Default/RadioButton.xaml
  21. 8
      src/Avalonia.Themes.Default/ScrollBar.xaml
  22. 4
      src/Avalonia.Themes.Default/Separator.xaml
  23. 6
      src/Avalonia.Themes.Default/Slider.xaml
  24. 6
      src/Avalonia.Themes.Default/TabStripItem.xaml
  25. 22
      src/Avalonia.Themes.Default/TextBox.xaml
  26. 18
      src/Avalonia.Themes.Default/ToggleButton.xaml
  27. 6
      src/Avalonia.Themes.Default/ToolTip.xaml
  28. 4
      src/Avalonia.Themes.Default/TreeView.xaml
  29. 2
      src/Avalonia.Themes.Default/TreeViewItem.xaml
  30. 4
      src/Avalonia.Themes.Default/Window.xaml
  31. 6
      tests/Avalonia.Markup.Xaml.UnitTests/Xaml/Style2.xaml

11
docs/tutorial/from-wpf.md

@ -73,17 +73,6 @@ and includes `DirectProperty` for turning standard CLR properties into Avalonia
properties. The common base class of `StyledProperty` and `DirectProperty`
is `AvaloniaProperty`.
# Resources
There is no `Resources` collection on controls in Avalonia, however `Style`s
do have a `Resources` collection for style-related resources. These can be
referred to using the `{StyleResource}` markup extension both inside and outside
styles.
For non-style-related resources, we suggest defining them in code and referring
to them in markup using the `{Static}` markup extension. To read more about the reasoning for this,
see [this issue comment](https://github.com/AvaloniaUI/Avalonia/issues/462#issuecomment-191849723).
## Grid
Column and row definitions can be specified in Avalonia using strings, avoiding

10
samples/ControlCatalog/Pages/BorderPage.xaml

@ -7,22 +7,22 @@
Margin="0,16,0,0"
HorizontalAlignment="Center"
Gap="16">
<Border BorderBrush="{StyleResource ThemeAccentBrush}" BorderThickness="2" Padding="16">
<Border BorderBrush="{DynamicResource ThemeAccentBrush}" BorderThickness="2" Padding="16">
<TextBlock>Border</TextBlock>
</Border>
<Border Background="{StyleResource ThemeAccentBrush2}"
BorderBrush="{StyleResource ThemeAccentBrush}"
<Border Background="{DynamicResource ThemeAccentBrush2}"
BorderBrush="{DynamicResource ThemeAccentBrush}"
BorderThickness="4"
Padding="16">
<TextBlock>Border and Background</TextBlock>
</Border>
<Border BorderBrush="{StyleResource ThemeAccentBrush}"
<Border BorderBrush="{DynamicResource ThemeAccentBrush}"
BorderThickness="4"
CornerRadius="8"
Padding="16">
<TextBlock>Rounded Corners</TextBlock>
</Border>
<Border Background="{StyleResource ThemeAccentBrush2}"
<Border Background="{DynamicResource ThemeAccentBrush2}"
CornerRadius="8"
Padding="16">
<TextBlock>Rounded Corners</TextBlock>

8
samples/ControlCatalog/Pages/ButtonPage.xaml

@ -11,7 +11,7 @@
<StackPanel Orientation="Vertical" Gap="8" Width="150">
<Button>Button</Button>
<Button Foreground="White">Foreground</Button>
<Button Background="{StyleResource ThemeAccentBrush}">Background</Button>
<Button Background="{DynamicResource ThemeAccentBrush}">Background</Button>
<Button IsEnabled="False">Disabled</Button>
<Button Content="Re-themed">
<Button.Styles>
@ -27,9 +27,9 @@
<StackPanel Orientation="Vertical" Gap="8" Width="150">
<Button BorderThickness="0">No Border</Button>
<Button BorderBrush="{StyleResource ThemeAccentBrush}">Border Color</Button>
<Button BorderBrush="{StyleResource ThemeAccentBrush}" BorderThickness="4">Thick Border</Button>
<Button BorderBrush="{StyleResource ThemeAccentBrush}" BorderThickness="4" IsEnabled="False">Disabled</Button>
<Button BorderBrush="{DynamicResource ThemeAccentBrush}">Border Color</Button>
<Button BorderBrush="{DynamicResource ThemeAccentBrush}" BorderThickness="4">Thick Border</Button>
<Button BorderBrush="{DynamicResource ThemeAccentBrush}" BorderThickness="4" IsEnabled="False">Disabled</Button>
</StackPanel>
</StackPanel>
</StackPanel>

2
samples/ControlCatalog/Pages/ContextMenuPage.xaml

@ -7,7 +7,7 @@
Margin="0,16,0,0"
HorizontalAlignment="Center"
Gap="16">
<Border Background="{StyleResource ThemeAccentBrush}"
<Border Background="{DynamicResource ThemeAccentBrush}"
Padding="48,48,48,48">
<Border.ContextMenu>
<ContextMenu>

2
samples/ControlCatalog/Pages/DropDownPage.xaml

@ -14,7 +14,7 @@
<DropDown SelectedIndex="0">
<DropDownItem>
<Panel>
<Rectangle Fill="{StyleResource ThemeAccentBrush}"/>
<Rectangle Fill="{DynamicResource ThemeAccentBrush}"/>
<TextBlock Margin="8">Control Items</TextBlock>
</Panel>
</DropDownItem>

8
samples/ControlCatalog/Pages/LayoutTransformControlPage.xaml

@ -10,10 +10,10 @@
RowDefinitions="24,Auto,24"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<Border Background="{StyleResource ThemeAccentBrush}" Grid.Column="1" Grid.Row="0"/>
<Border Background="{StyleResource ThemeAccentBrush}" Grid.Column="0" Grid.Row="1"/>
<Border Background="{StyleResource ThemeAccentBrush}" Grid.Column="2" Grid.Row="1"/>
<Border Background="{StyleResource ThemeAccentBrush}" Grid.Column="1" Grid.Row="2"/>
<Border Background="{DynamicResource ThemeAccentBrush}" Grid.Column="1" Grid.Row="0"/>
<Border Background="{DynamicResource ThemeAccentBrush}" Grid.Column="0" Grid.Row="1"/>
<Border Background="{DynamicResource ThemeAccentBrush}" Grid.Column="2" Grid.Row="1"/>
<Border Background="{DynamicResource ThemeAccentBrush}" Grid.Column="1" Grid.Row="2"/>
<LayoutTransformControl Name="layoutTransform" Grid.Column="1" Grid.Row="1">
<LayoutTransformControl.LayoutTransform>

4
samples/ControlCatalog/SideBar.xaml

@ -3,7 +3,7 @@
<Setter Property="Template">
<ControlTemplate>
<DockPanel>
<ScrollViewer MinWidth="190" Background="{StyleResource ThemeAccentBrush}" DockPanel.Dock="Left">
<ScrollViewer MinWidth="190" Background="{DynamicResource ThemeAccentBrush}" DockPanel.Dock="Left">
<TabStrip Name="PART_TabStrip"
MemberSelector="{Static TabControl.HeaderSelector}"
Items="{TemplateBinding Items}"
@ -35,6 +35,6 @@
</Style>
<Style Selector="TabControl.sidebar TabStripItem:selected">
<Setter Property="Background" Value="{StyleResource ThemeAccentBrush2}"/>
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush2}"/>
</Style>
</Styles>

2
samples/RenderTest/Pages/ClippingPage.xaml

@ -5,7 +5,7 @@
Width="100"
Height="100"
Clip="M 58.625 0.07421875 C 50.305778 0.26687364 42.411858 7.0346526 41.806641 15.595703 C 42.446442 22.063923 39.707425 13.710754 36.982422 12.683594 C 29.348395 6.1821635 16.419398 8.4359222 11.480469 17.195312 C 6.0935256 25.476803 9.8118851 37.71125 18.8125 41.6875 C 9.1554771 40.62945 -0.070876925 49.146842 0.21679688 58.857422 C 0.21545578 60.872512 0.56758794 62.88911 1.2617188 64.78125 C 4.3821886 74.16708 16.298268 78.921772 25.03125 74.326172 C 28.266843 72.062552 26.298191 74.214838 25.414062 76.398438 C 21.407348 85.589198 27.295992 97.294293 37.097656 99.501953 C 46.864883 102.3541 57.82177 94.726518 58.539062 84.580078 C 58.142158 79.498998 59.307538 83.392694 61.207031 85.433594 C 67.532324 93.056874 80.440232 93.192029 86.882812 85.630859 C 93.836392 78.456939 92.396838 65.538666 84.115234 60.009766 C 79.783641 57.904836 83.569793 58.802369 86.375 58.193359 C 96.383335 56.457569 102.87506 44.824101 99.083984 35.394531 C 95.963498 26.008711 84.047451 21.254079 75.314453 25.849609 C 72.078834 28.113269 74.047517 25.960974 74.931641 23.777344 C 78.93827 14.586564 73.049722 2.8815081 63.248047 0.67382812 C 61.721916 0.22817968 60.165597 0.038541919 58.625 0.07421875 z ">
<Border Name="clipChild" Background="{StyleResource ThemeAccentBrush}" Margin="4">
<Border Name="clipChild" Background="{DynamicResource ThemeAccentBrush}" Margin="4">
<!-- Setting opacity puts the TextBox on a new layer -->
<TextBox Text="Avalonia" Opacity="0.9" VerticalAlignment="Center"/>
</Border>

8
samples/RenderTest/Pages/DrawingPage.xaml

@ -49,7 +49,7 @@
BorderThickness="1"
BorderBrush="Gray"
Margin="5">
<DrawingPresenter Drawing="{StyleResource Bulb}" />
<DrawingPresenter Drawing="{DynamicResource Bulb}" />
</Border>
<TextBlock Text="Fill"
Margin="3"
@ -61,7 +61,7 @@
BorderThickness="1"
BorderBrush="Gray"
Margin="5">
<DrawingPresenter Drawing="{StyleResource Bulb}"
<DrawingPresenter Drawing="{DynamicResource Bulb}"
Width="100"
Height="50"
Stretch="Fill" />
@ -76,7 +76,7 @@
BorderThickness="1"
BorderBrush="Gray"
Margin="5">
<DrawingPresenter Drawing="{StyleResource Bulb}"
<DrawingPresenter Drawing="{DynamicResource Bulb}"
Width="100"
Height="50"
Stretch="Uniform" />
@ -91,7 +91,7 @@
BorderThickness="1"
BorderBrush="Gray"
Margin="5">
<DrawingPresenter Drawing="{StyleResource Bulb}"
<DrawingPresenter Drawing="{DynamicResource Bulb}"
Width="100"
Height="50"
Stretch="UniformToFill" />

4
samples/RenderTest/SideBar.xaml

@ -3,7 +3,7 @@
<Setter Property="Template">
<ControlTemplate>
<DockPanel>
<ScrollViewer MinWidth="190" Background="{StyleResource ThemeAccentBrush}" DockPanel.Dock="Left">
<ScrollViewer MinWidth="190" Background="{DynamicResource ThemeAccentBrush}" DockPanel.Dock="Left">
<TabStrip Name="PART_TabStrip"
MemberSelector="{Static TabControl.HeaderSelector}"
Items="{TemplateBinding Items}"
@ -35,6 +35,6 @@
</Style>
<Style Selector="TabControl.sidebar TabStripItem:selected">
<Setter Property="Background" Value="{StyleResource ThemeAccentBrush2}"/>
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush2}"/>
</Style>
</Styles>

14
src/Avalonia.Themes.Default/Button.xaml

@ -1,9 +1,9 @@
<Styles xmlns="https://github.com/avaloniaui">
<Style Selector="Button">
<Setter Property="Background" Value="{StyleResource ThemeControlMidBrush}"/>
<Setter Property="BorderBrush" Value="{StyleResource ThemeBorderLightBrush}"/>
<Setter Property="BorderThickness" Value="{StyleResource ThemeBorderThickness}"/>
<Setter Property="Foreground" Value="{StyleResource ThemeForegroundBrush}"/>
<Setter Property="Background" Value="{DynamicResource ThemeControlMidBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderLightBrush}"/>
<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"/>
@ -23,12 +23,12 @@
</Setter>
</Style>
<Style Selector="Button:pointerover /template/ ContentPresenter">
<Setter Property="BorderBrush" Value="{StyleResource ThemeBorderMidBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/>
</Style>
<Style Selector="Button:pressed /template/ ContentPresenter">
<Setter Property="Background" Value="{StyleResource ThemeControlDarkBrush}"/>
<Setter Property="Background" Value="{DynamicResource ThemeControlDarkBrush}"/>
</Style>
<Style Selector="Button:disabled">
<Setter Property="Opacity" Value="{StyleResource ThemeDisabledOpacity}"/>
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}"/>
</Style>
</Styles>

10
src/Avalonia.Themes.Default/CheckBox.xaml

@ -1,8 +1,8 @@
<Styles xmlns="https://github.com/avaloniaui">
<Style Selector="CheckBox">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="{StyleResource ThemeBorderMidBrush}"/>
<Setter Property="BorderThickness" Value="{StyleResource ThemeBorderThickness}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/>
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}"/>
<Setter Property="Template">
<ControlTemplate>
<Grid ColumnDefinitions="Auto,*" Background="{TemplateBinding Background}">
@ -13,7 +13,7 @@
Height="18"
VerticalAlignment="Center">
<Path Name="checkMark"
Fill="{StyleResource HighlightBrush}"
Fill="{DynamicResource HighlightBrush}"
Width="11"
Height="10"
Stretch="Uniform"
@ -32,7 +32,7 @@
</Setter>
</Style>
<Style Selector="CheckBox:pointerover /template/ Border#border">
<Setter Property="BorderBrush" Value="{StyleResource ThemeBorderDarkBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderDarkBrush}"/>
</Style>
<Style Selector="CheckBox /template/ Path#checkMark">
<Setter Property="IsVisible" Value="False"/>
@ -41,6 +41,6 @@
<Setter Property="IsVisible" Value="True"/>
</Style>
<Style Selector="CheckBox:disabled /template/ Border#border">
<Setter Property="Opacity" Value="{StyleResource ThemeDisabledOpacity}"/>
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}"/>
</Style>
</Styles>

10
src/Avalonia.Themes.Default/DropDown.xaml

@ -1,7 +1,7 @@
<Styles xmlns="https://github.com/avaloniaui">
<Style Selector="DropDown">
<Setter Property="BorderBrush" Value="{StyleResource ThemeBorderMidBrush}"/>
<Setter Property="BorderThickness" Value="{StyleResource ThemeBorderThickness}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/>
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}"/>
<Setter Property="Padding" Value="4"/>
<Setter Property="Template">
<ControlTemplate>
@ -21,7 +21,7 @@
Focusable="False"
IsChecked="{TemplateBinding IsDropDownOpen, Mode=TwoWay}"
Grid.Column="1">
<Path Fill="{StyleResource ThemeForegroundBrush}"
<Path Fill="{DynamicResource ThemeForegroundBrush}"
Width="8"
Height="4"
Stretch="Uniform"
@ -35,7 +35,7 @@
MaxHeight="{TemplateBinding MaxDropDownHeight}"
PlacementTarget="{TemplateBinding}"
StaysOpen="False">
<Border BorderBrush="{StyleResource ThemeBorderMidBrush}"
<Border BorderBrush="{DynamicResource ThemeBorderMidBrush}"
BorderThickness="1">
<ScrollViewer>
<ItemsPresenter Name="PART_ItemsPresenter"
@ -51,6 +51,6 @@
</Setter>
</Style>
<Style Selector="DropDown:pointerover /template/ Border#border">
<Setter Property="BorderBrush" Value="{StyleResource ThemeBorderDarkBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderDarkBrush}"/>
</Style>
</Styles>

4
src/Avalonia.Themes.Default/EmbeddableControlRoot.xaml

@ -1,7 +1,7 @@
<Style xmlns="https://github.com/avaloniaui" Selector="EmbeddableControlRoot">
<Setter Property="Background" Value="{StyleResource ThemeBackgroundBrush}"/>
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}"/>
<Setter Property="FontFamily" Value="Segoe UI"/>
<Setter Property="FontSize" Value="{StyleResource FontSizeNormal}"/>
<Setter Property="FontSize" Value="{DynamicResource FontSizeNormal}"/>
<Setter Property="Template">
<ControlTemplate>
<Border Background="{TemplateBinding Background}">

8
src/Avalonia.Themes.Default/GridSplitter.xaml

@ -1,7 +1,7 @@
<Styles xmlns="https://github.com/avaloniaui">
<Style Selector="GridSplitter:vertical">
<Setter Property="Width" Value="6"/>
<Setter Property="Background" Value="{StyleResource ThemeControlLightBrush}"/>
<Setter Property="Background" Value="{DynamicResource ThemeControlLightBrush}"/>
<Setter Property="Template">
<ControlTemplate>
<Border Background="{TemplateBinding Background}">
@ -11,7 +11,7 @@
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="Width" Value="4"/>
<Setter Property="Height" Value="4"/>
<Setter Property="Fill" Value="{StyleResource ThemeControlMidBrush}"/>
<Setter Property="Fill" Value="{DynamicResource ThemeControlMidBrush}"/>
<Setter Property="Margin" Value="1"/>
</Style>
</StackPanel.Styles>
@ -25,7 +25,7 @@
</Style>
<Style Selector="GridSplitter:horizontal">
<Setter Property="Height" Value="6"/>
<Setter Property="Background" Value="{StyleResource ThemeControlLightBrush}"/>
<Setter Property="Background" Value="{DynamicResource ThemeControlLightBrush}"/>
<Setter Property="Template">
<ControlTemplate>
<Border Background="{TemplateBinding Background}">
@ -35,7 +35,7 @@
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Width" Value="4"/>
<Setter Property="Height" Value="4"/>
<Setter Property="Fill" Value="{StyleResource ThemeControlMidBrush}"/>
<Setter Property="Fill" Value="{DynamicResource ThemeControlMidBrush}"/>
<Setter Property="Margin" Value="1"/>
</Style>
</StackPanel.Styles>

6
src/Avalonia.Themes.Default/ListBox.xaml

@ -1,7 +1,7 @@
<Style xmlns="https://github.com/avaloniaui" Selector="ListBox">
<Setter Property="Background" Value="{StyleResource ThemeBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{StyleResource ThemeBorderMidBrush}"/>
<Setter Property="BorderThickness" Value="{StyleResource ThemeBorderThickness}"/>
<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>

18
src/Avalonia.Themes.Default/MenuItem.xaml

@ -38,7 +38,7 @@
</ContentPresenter>
<Path Name="rightArrow"
Data="M0,0L4,3.5 0,7z"
Fill="{StyleResource ThemeForegroundBrush}"
Fill="{DynamicResource ThemeForegroundBrush}"
Margin="10,0,0,0"
VerticalAlignment="Center"
Grid.Column="3"/>
@ -47,7 +47,7 @@
StaysOpen="True"
IsOpen="{TemplateBinding Path=IsSubMenuOpen, Mode=TwoWay}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{StyleResource ThemeBorderMidBrush}"
BorderBrush="{DynamicResource ThemeBorderMidBrush}"
BorderThickness="1">
<ScrollViewer>
<Panel>
@ -58,7 +58,7 @@
Margin="2"
MemberSelector="{TemplateBinding MemberSelector}"/>
<Rectangle Name="iconSeparator"
Fill="{StyleResource ThemeControlMidBrush}"
Fill="{DynamicResource ThemeControlMidBrush}"
HorizontalAlignment="Left"
IsHitTestVisible="False"
Margin="29,2,0,2"
@ -94,7 +94,7 @@
IsOpen="{TemplateBinding Path=IsSubMenuOpen, Mode=TwoWay}"
StaysOpen="True">
<Border Background="{TemplateBinding Background}"
BorderBrush="{StyleResource ThemeBorderMidBrush}"
BorderBrush="{DynamicResource ThemeBorderMidBrush}"
BorderThickness="1">
<ScrollViewer>
<Panel>
@ -105,7 +105,7 @@
Margin="2"
MemberSelector="{TemplateBinding MemberSelector}"/>
<Rectangle Name="iconSeparator"
Fill="{StyleResource ThemeControlMidBrush}"
Fill="{DynamicResource ThemeControlMidBrush}"
HorizontalAlignment="Left"
IsHitTestVisible="False"
Margin="29,2,0,2"
@ -121,13 +121,13 @@
</Style>
<Style Selector="MenuItem:selected /template/ Border#root">
<Setter Property="Background" Value="{StyleResource ThemeAccentBrush4}"/>
<Setter Property="BorderBrush" Value="{StyleResource ThemeAccentBrush}"/>
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush4}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ThemeAccentBrush}"/>
</Style>
<Style Selector="MenuItem:pointerover /template/ Border#root">
<Setter Property="Background" Value="{StyleResource ThemeAccentBrush4}"/>
<Setter Property="BorderBrush" Value="{StyleResource ThemeAccentBrush}"/>
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush4}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ThemeAccentBrush}"/>
</Style>
<Style Selector="MenuItem:empty /template/ Path#rightArrow">

2
src/Avalonia.Themes.Default/PopupRoot.xaml

@ -1,5 +1,5 @@
<Style xmlns="https://github.com/avaloniaui" Selector="PopupRoot">
<Setter Property="Background" Value="{StyleResource ThemeBackgroundBrush}"/>
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}"/>
<Setter Property="Template">
<ControlTemplate>
<ContentPresenter Name="PART_ContentPresenter"

4
src/Avalonia.Themes.Default/ProgressBar.xaml

@ -1,6 +1,6 @@
<Style xmlns="https://github.com/avaloniaui" Selector="ProgressBar">
<Setter Property="Background" Value="{StyleResource ThemeAccentBrush4}"/>
<Setter Property="Foreground" Value="{StyleResource ThemeAccentBrush}"/>
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush4}"/>
<Setter Property="Foreground" Value="{DynamicResource ThemeAccentBrush}"/>
<Setter Property="MinHeight" Value="14"/>
<Setter Property="MinWidth" Value="200"/>
<Setter Property="Template">

10
src/Avalonia.Themes.Default/RadioButton.xaml

@ -1,8 +1,8 @@
<Styles xmlns="https://github.com/avaloniaui">
<Style Selector="RadioButton">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="{StyleResource ThemeBorderMidBrush}"/>
<Setter Property="BorderThickness" Value="{StyleResource ThemeBorderThickness}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/>
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}"/>
<Setter Property="Template">
<ControlTemplate>
<Grid ColumnDefinitions="Auto,*" Background="{TemplateBinding Background}">
@ -13,7 +13,7 @@
Height="18"
VerticalAlignment="Center"/>
<Ellipse Name="checkMark"
Fill="{StyleResource HighlightBrush}"
Fill="{DynamicResource HighlightBrush}"
Width="10"
Height="10"
Stretch="Uniform"
@ -31,7 +31,7 @@
</Setter>
</Style>
<Style Selector="RadioButton:pointerover /template/ Ellipse#border">
<Setter Property="Stroke" Value="{StyleResource ThemeBorderDarkBrush}"/>
<Setter Property="Stroke" Value="{DynamicResource ThemeBorderDarkBrush}"/>
</Style>
<Style Selector="RadioButton /template/ Ellipse#checkMark">
<Setter Property="IsVisible" Value="False"/>
@ -40,6 +40,6 @@
<Setter Property="IsVisible" Value="True"/>
</Style>
<Style Selector="RadioButton:disabled /template/ Ellipse#border">
<Setter Property="Opacity" Value="{StyleResource ThemeDisabledOpacity}"/>
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}"/>
</Style>
</Styles>

8
src/Avalonia.Themes.Default/ScrollBar.xaml

@ -2,7 +2,7 @@
<Style Selector="ScrollBar">
<Setter Property="Template">
<ControlTemplate>
<Border Background="{StyleResource ThemeControlMidBrush}">
<Border Background="{DynamicResource ThemeControlMidBrush}">
<Grid RowDefinitions="10,*,10">
<RepeatButton Name="PART_LineUpButton"
Classes="repeat"
@ -30,7 +30,7 @@
<Thumb Name="thumb">
<Thumb.Template>
<ControlTemplate>
<Border Background="{StyleResource ThemeControlDarkBrush}" />
<Border Background="{DynamicResource ThemeControlDarkBrush}" />
</ControlTemplate>
</Thumb.Template>
</Thumb>
@ -53,7 +53,7 @@
Value="10" />
<Setter Property="Template">
<ControlTemplate>
<Border Background="{StyleResource ThemeControlMidBrush}">
<Border Background="{DynamicResource ThemeControlMidBrush}">
<Grid ColumnDefinitions="10,*,10">
<RepeatButton Name="PART_LineUpButton"
Classes="repeat"
@ -81,7 +81,7 @@
<Thumb Name="thumb">
<Thumb.Template>
<ControlTemplate>
<Border Background="{StyleResource ThemeControlDarkBrush}" />
<Border Background="{DynamicResource ThemeControlDarkBrush}" />
</ControlTemplate>
</Thumb.Template>
</Thumb>

4
src/Avalonia.Themes.Default/Separator.xaml

@ -11,13 +11,13 @@
</Style>
<Style Selector="MenuItem > Separator">
<Setter Property="Background" Value="{StyleResource ThemeControlMidBrush}"/>
<Setter Property="Background" Value="{DynamicResource ThemeControlMidBrush}"/>
<Setter Property="Margin" Value="29,1,0,1"/>
<Setter Property="Height" Value="1"/>
</Style>
<Style Selector="ContextMenu > Separator">
<Setter Property="Background" Value="{StyleResource ThemeControlMidBrush}"/>
<Setter Property="Background" Value="{DynamicResource ThemeControlMidBrush}"/>
<Setter Property="Margin" Value="29,1,0,1"/>
<Setter Property="Height" Value="1"/>
</Style>

6
src/Avalonia.Themes.Default/Slider.xaml

@ -24,7 +24,7 @@
<Thumb.Template>
<ControlTemplate>
<Grid>
<Ellipse Width="12" Height="12" Fill="{StyleResource ThemeAccentBrush}"/>
<Ellipse Width="12" Height="12" Fill="{DynamicResource ThemeAccentBrush}"/>
</Grid>
</ControlTemplate>
</Thumb.Template>
@ -59,7 +59,7 @@
<Thumb.Template>
<ControlTemplate>
<Grid>
<Ellipse Width="12" Height="12" Fill="{StyleResource ThemeAccentBrush}"/>
<Ellipse Width="12" Height="12" Fill="{DynamicResource ThemeAccentBrush}"/>
</Grid>
</ControlTemplate>
</Thumb.Template>
@ -77,7 +77,7 @@
</Style>
<Style Selector="Slider /template/ Border#TrackBackground">
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="BorderBrush" Value="{StyleResource ThemeBorderLightBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderLightBrush}"/>
</Style>
<Style Selector="Slider /template/ RepeatButton.repeattrack">
<Setter Property="Background" Value="Transparent"/>

6
src/Avalonia.Themes.Default/TabStripItem.xaml

@ -1,8 +1,8 @@
<Styles xmlns="https://github.com/avaloniaui">
<Style Selector="TabStripItem">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="FontSize" Value="{StyleResource FontSizeLarge}"/>
<Setter Property="Foreground" Value="{StyleResource ThemeForegroundLightBrush}"/>
<Setter Property="FontSize" Value="{DynamicResource FontSizeLarge}"/>
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundLightBrush}"/>
<Setter Property="Template">
<ControlTemplate>
<ContentPresenter Name="PART_ContentPresenter"
@ -16,6 +16,6 @@
</Setter>
</Style>
<Style Selector="TabStripItem:selected">
<Setter Property="Foreground" Value="{StyleResource ThemeForegroundBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}"/>
</Style>
</Styles>

22
src/Avalonia.Themes.Default/TextBox.xaml

@ -1,8 +1,8 @@
<Styles xmlns="https://github.com/avaloniaui">
<Style Selector="TextBox">
<Setter Property="Background" Value="{StyleResource ThemeBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{StyleResource ThemeBorderMidBrush}"/>
<Setter Property="BorderThickness" Value="{StyleResource ThemeBorderThickness}"/>
<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>
@ -13,8 +13,8 @@
<DockPanel Margin="{TemplateBinding Padding}">
<TextBlock Name="floatingWatermark"
Foreground="{StyleResource ThemeAccentBrush}"
FontSize="{StyleResource FontSizeSmall}"
Foreground="{DynamicResource ThemeAccentBrush}"
FontSize="{DynamicResource FontSizeSmall}"
Text="{TemplateBinding Watermark}"
DockPanel.Dock="Top">
<TextBlock.IsVisible>
@ -33,7 +33,7 @@
<ToolTip.Tip>
<ItemsControl Items="{TemplateBinding DataValidationErrors}" MemberSelector="Message"/>
</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="{StyleResource ErrorBrush}" StrokeThickness="2"/>
<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>
<ScrollViewer CanScrollHorizontally="{TemplateBinding CanScrollHorizontally}"
@ -62,13 +62,13 @@
</Setter>
</Style>
<Style Selector="TextBox:pointerover /template/ Border#border">
<Setter Property="BorderBrush" Value="{StyleResource ThemeBorderDarkBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderDarkBrush}"/>
</Style>
<Style Selector="TextBox:focus /template/ Border#border">
<Setter Property="BorderBrush" Value="{StyleResource ThemeBorderDarkBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderDarkBrush}"/>
</Style>
<Style Selector="TextBox:error /template/ Border#border">
<Setter Property="BorderBrush" Value="{StyleResource ErrorBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ErrorBrush}"/>
</Style>
<Style Selector="TextBox /template/ Canvas#error">
<Setter Property="IsVisible" Value="False"/>
@ -77,7 +77,7 @@
<Setter Property="IsVisible" Value="True"/>
</Style>
<Style Selector="TextBox /template/ ToolTip">
<Setter Property="Background" Value="{StyleResource ErrorBrushLight}"/>
<Setter Property="BorderBrush" Value="{StyleResource ErrorBrush}"/>
<Setter Property="Background" Value="{DynamicResource ErrorBrushLight}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ErrorBrush}"/>
</Style>
</Styles>

18
src/Avalonia.Themes.Default/ToggleButton.xaml

@ -1,9 +1,9 @@
<Styles xmlns="https://github.com/avaloniaui">
<Style Selector="ToggleButton">
<Setter Property="Background" Value="{StyleResource ThemeControlMidBrush}"/>
<Setter Property="BorderBrush" Value="{StyleResource ThemeBorderLightBrush}"/>
<Setter Property="BorderThickness" Value="{StyleResource ThemeBorderThickness}"/>
<Setter Property="Foreground" Value="{StyleResource ThemeForegroundBrush}"/>
<Setter Property="Background" Value="{DynamicResource ThemeControlMidBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderLightBrush}"/>
<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"/>
@ -23,16 +23,16 @@
</Setter>
</Style>
<Style Selector="ToggleButton:checked /template/ ContentPresenter">
<Setter Property="Background" Value="{StyleResource ThemeControlDarkBrush}"/>
<Setter Property="BorderBrush" Value="{StyleResource ThemeBorderMidBrush}"/>
<Setter Property="Background" Value="{DynamicResource ThemeControlDarkBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/>
</Style>
<Style Selector="ToggleButton:pointerover /template/ ContentPresenter">
<Setter Property="BorderBrush" Value="{StyleResource ThemeBorderMidBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/>
</Style>
<Style Selector="ToggleButton:pressed /template/ ContentPresenter">
<Setter Property="Background" Value="{StyleResource ThemeControlDarkBrush}"/>
<Setter Property="Background" Value="{DynamicResource ThemeControlDarkBrush}"/>
</Style>
<Style Selector="ToggleButton:disabled">
<Setter Property="Opacity" Value="{StyleResource ThemeDisabledOpacity}"/>
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}"/>
</Style>
</Styles>

6
src/Avalonia.Themes.Default/ToolTip.xaml

@ -1,7 +1,7 @@
<Style xmlns="https://github.com/avaloniaui" Selector="ToolTip">
<Setter Property="Background" Value="{StyleResource ThemeBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{StyleResource ThemeBorderMidBrush}"/>
<Setter Property="BorderThickness" Value="{StyleResource ThemeBorderThickness}"/>
<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>

4
src/Avalonia.Themes.Default/TreeView.xaml

@ -1,7 +1,7 @@
<Style xmlns="https://github.com/avaloniaui" Selector="TreeView">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="{StyleResource ThemeBorderMidBrush}"/>
<Setter Property="BorderThickness" Value="{StyleResource ThemeBorderThickness}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/>
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}"/>
<Setter Property="Padding" Value="4"/>
<Setter Property="Template">
<ControlTemplate>

2
src/Avalonia.Themes.Default/TreeViewItem.xaml

@ -36,7 +36,7 @@
Height="12"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<Path Fill="{StyleResource ThemeForegroundBrush}"
<Path Fill="{DynamicResource ThemeForegroundBrush}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="M 0 2 L 4 6 L 0 10 Z"/>

4
src/Avalonia.Themes.Default/Window.xaml

@ -1,7 +1,7 @@
<Style xmlns="https://github.com/avaloniaui" Selector="Window">
<Setter Property="Background" Value="{StyleResource ThemeBackgroundBrush}"/>
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}"/>
<Setter Property="FontFamily" Value="Segoe UI"/>
<Setter Property="FontSize" Value="{StyleResource FontSizeNormal}"/>
<Setter Property="FontSize" Value="{DynamicResource FontSizeNormal}"/>
<Setter Property="Template">
<ControlTemplate>
<Border Background="{TemplateBinding Background}">

6
tests/Avalonia.Markup.Xaml.UnitTests/Xaml/Style2.xaml

@ -1,8 +1,8 @@
<Style xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style.Resources>
<SolidColorBrush x:Key="RedBrush" Color="{StyleResource Red}"/>
<SolidColorBrush x:Key="GreenBrush" Color="{StyleResource Green}"/>
<SolidColorBrush x:Key="BlueBrush" Color="{StyleResource Blue}"/>
<SolidColorBrush x:Key="RedBrush" Color="{DynamicResource Red}"/>
<SolidColorBrush x:Key="GreenBrush" Color="{DynamicResource Green}"/>
<SolidColorBrush x:Key="BlueBrush" Color="{DynamicResource Blue}"/>
</Style.Resources>
</Style>
Loading…
Cancel
Save