Browse Source

Merge pull request #5193 from AvaloniaUI/fluent-prefer-dynamic-resource-for-some-controls

[Fluent] Prefer DynamicResource for resources used in controls
pull/5299/head
Max Katz 6 years ago
committed by GitHub
parent
commit
e0cd8ae12c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      src/Avalonia.Themes.Fluent/Controls/Button.xaml
  2. 2
      src/Avalonia.Themes.Fluent/Controls/CalendarDatePicker.xaml
  3. 4
      src/Avalonia.Themes.Fluent/Controls/DatePicker.xaml
  4. 6
      src/Avalonia.Themes.Fluent/Controls/FocusAdorner.xaml
  5. 2
      src/Avalonia.Themes.Fluent/Controls/ListBoxItem.xaml
  6. 2
      src/Avalonia.Themes.Fluent/Controls/Menu.xaml
  7. 6
      src/Avalonia.Themes.Fluent/Controls/MenuItem.xaml
  8. 2
      src/Avalonia.Themes.Fluent/Controls/TabControl.xaml
  9. 10
      src/Avalonia.Themes.Fluent/Controls/TabItem.xaml
  10. 2
      src/Avalonia.Themes.Fluent/Controls/TabStripItem.xaml
  11. 4
      src/Avalonia.Themes.Fluent/Controls/TimePicker.xaml
  12. 2
      src/Avalonia.Themes.Fluent/Controls/ToggleSwitch.xaml

3
src/Avalonia.Themes.Fluent/Controls/Button.xaml

@ -16,8 +16,7 @@
<Setter Property="Foreground" Value="{DynamicResource ButtonForeground}" /> <Setter Property="Foreground" Value="{DynamicResource ButtonForeground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonBorderBrush}" /> <Setter Property="BorderBrush" Value="{DynamicResource ButtonBorderBrush}" />
<Setter Property="BorderThickness" Value="{DynamicResource ButtonBorderThemeThickness}" /> <Setter Property="BorderThickness" Value="{DynamicResource ButtonBorderThemeThickness}" />
<Setter Property="Padding" Value="8,5,8,5" /> <Setter Property="Padding" Value="{DynamicResource ButtonPadding}" />
<Setter Property="Padding" Value="{StaticResource ButtonPadding}" />
<Setter Property="HorizontalAlignment" Value="Left" /> <Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" /> <Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="FontWeight" Value="Normal" /> <Setter Property="FontWeight" Value="Normal" />

2
src/Avalonia.Themes.Fluent/Controls/CalendarDatePicker.xaml

@ -76,7 +76,7 @@
Grid.Row="1" Grid.Row="1"
Grid.ColumnSpan="4" Grid.ColumnSpan="4"
Grid.RowSpan="3" Grid.RowSpan="3"
FontSize="{StaticResource CalendarDatePickerCurrentDayFontSize}" FontSize="{DynamicResource CalendarDatePickerCurrentDayFontSize}"
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 SystemControlBackgroundChromeBlackHighBrush}" StrokeThickness="0" Grid.ColumnSpan="4" Width="3" Height="3"/> <Ellipse HorizontalAlignment="Center" VerticalAlignment="Center" Fill="{DynamicResource SystemControlBackgroundChromeBlackHighBrush}" StrokeThickness="0" Grid.ColumnSpan="4" Width="3" Height="3"/>

4
src/Avalonia.Themes.Fluent/Controls/DatePicker.xaml

@ -141,8 +141,8 @@
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
IsEnabled="{TemplateBinding IsEnabled}" IsEnabled="{TemplateBinding IsEnabled}"
MinWidth="{StaticResource DatePickerThemeMinWidth}" MinWidth="{DynamicResource DatePickerThemeMinWidth}"
MaxWidth="{StaticResource DatePickerThemeMaxWidth}" MaxWidth="{DynamicResource DatePickerThemeMaxWidth}"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
HorizontalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"

6
src/Avalonia.Themes.Fluent/Controls/FocusAdorner.xaml

@ -10,10 +10,10 @@
<Style Selector=":is(Control)"> <Style Selector=":is(Control)">
<Setter Property="FocusAdorner"> <Setter Property="FocusAdorner">
<FocusAdornerTemplate> <FocusAdornerTemplate>
<Border BorderThickness="{StaticResource SystemControlFocusVisualPrimaryThickness}" <Border BorderThickness="{DynamicResource SystemControlFocusVisualPrimaryThickness}"
BorderBrush="{DynamicResource SystemControlFocusVisualPrimaryBrush}" BorderBrush="{DynamicResource SystemControlFocusVisualPrimaryBrush}"
Margin="{StaticResource SystemControlFocusVisualMargin}"> Margin="{DynamicResource SystemControlFocusVisualMargin}">
<Border BorderThickness="{StaticResource SystemControlFocusVisualSecondaryThickness}" <Border BorderThickness="{DynamicResource SystemControlFocusVisualSecondaryThickness}"
BorderBrush="{DynamicResource SystemControlFocusVisualSecondaryBrush}" /> BorderBrush="{DynamicResource SystemControlFocusVisualSecondaryBrush}" />
</Border> </Border>
</FocusAdornerTemplate> </FocusAdornerTemplate>

2
src/Avalonia.Themes.Fluent/Controls/ListBoxItem.xaml

@ -17,7 +17,7 @@
</Styles.Resources> </Styles.Resources>
<Style Selector="ListBoxItem"> <Style Selector="ListBoxItem">
<Setter Property="Background" Value="Transparent" /> <Setter Property="Background" Value="Transparent" />
<Setter Property="Padding" Value="{StaticResource ListBoxItemPadding}" /> <Setter Property="Padding" Value="{DynamicResource ListBoxItemPadding}" />
<Setter Property="HorizontalContentAlignment" Value="Left" /> <Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>

2
src/Avalonia.Themes.Fluent/Controls/Menu.xaml

@ -16,7 +16,7 @@
</Style.Resources> </Style.Resources>
<Setter Property="Background" Value="Transparent" /> <Setter Property="Background" Value="Transparent" />
<Setter Property="Height" Value="{StaticResource MenuBarHeight}" /> <Setter Property="Height" Value="{DynamicResource MenuBarHeight}" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Border Background="{TemplateBinding Background}" <Border Background="{TemplateBinding Background}"

6
src/Avalonia.Themes.Fluent/Controls/MenuItem.xaml

@ -112,7 +112,7 @@
<Popup Name="PART_Popup" <Popup Name="PART_Popup"
WindowManagerAddShadowHint="False" WindowManagerAddShadowHint="False"
PlacementMode="Right" PlacementMode="Right"
HorizontalOffset="{StaticResource MenuFlyoutSubItemPopupHorizontalOffset}" HorizontalOffset="{DynamicResource MenuFlyoutSubItemPopupHorizontalOffset}"
IsLightDismissEnabled="True" IsLightDismissEnabled="True"
IsOpen="{TemplateBinding IsSubMenuOpen, Mode=TwoWay}"> IsOpen="{TemplateBinding IsSubMenuOpen, Mode=TwoWay}">
<Border Background="{DynamicResource MenuFlyoutPresenterBackground}" <Border Background="{DynamicResource MenuFlyoutPresenterBackground}"
@ -189,12 +189,12 @@
<Style Selector="MenuItem"> <Style Selector="MenuItem">
<!-- Narrow padding should be used for mouse input, when non-narrow one should be used for touch input in future. --> <!-- Narrow padding should be used for mouse input, when non-narrow one should be used for touch input in future. -->
<Setter Property="Padding" Value="{StaticResource MenuFlyoutItemThemePaddingNarrow}" /> <Setter Property="Padding" Value="{DynamicResource MenuFlyoutItemThemePaddingNarrow}" />
</Style> </Style>
<Style Selector="Menu > MenuItem"> <Style Selector="Menu > MenuItem">
<!-- Custom padding for Menu > MenuItem --> <!-- Custom padding for Menu > MenuItem -->
<Setter Property="Padding" Value="{StaticResource MenuBarItemPadding}" /> <Setter Property="Padding" Value="{DynamicResource MenuBarItemPadding}" />
</Style> </Style>
<Style Selector="MenuItem /template/ ContentPresenter#PART_IconPresenter"> <Style Selector="MenuItem /template/ ContentPresenter#PART_IconPresenter">

2
src/Avalonia.Themes.Fluent/Controls/TabControl.xaml

@ -60,6 +60,6 @@
<Setter Property="Orientation" Value="Vertical" /> <Setter Property="Orientation" Value="Vertical" />
</Style> </Style>
<Style Selector="TabControl[TabStripPlacement=Top] /template/ ItemsPresenter#PART_ItemsPresenter"> <Style Selector="TabControl[TabStripPlacement=Top] /template/ ItemsPresenter#PART_ItemsPresenter">
<Setter Property="Margin" Value="{StaticResource TabControlTopPlacementItemMargin}" /> <Setter Property="Margin" Value="{DynamicResource TabControlTopPlacementItemMargin}" />
</Style> </Style>
</Styles> </Styles>

10
src/Avalonia.Themes.Fluent/Controls/TabItem.xaml

@ -97,8 +97,8 @@
<!-- TabStripPlacement States Group --> <!-- TabStripPlacement States Group -->
<Style Selector="TabItem[TabStripPlacement=Left] /template/ Border#PART_SelectedPipe"> <Style Selector="TabItem[TabStripPlacement=Left] /template/ Border#PART_SelectedPipe">
<Setter Property="Width" Value="{StaticResource TabItemPipeThickness}" /> <Setter Property="Width" Value="{DynamicResource TabItemPipeThickness}" />
<Setter Property="Height" Value="{StaticResource TabItemVerticalPipeHeight}" /> <Setter Property="Height" Value="{DynamicResource TabItemVerticalPipeHeight}" />
<Setter Property="Margin" Value="0,0,2,0" /> <Setter Property="Margin" Value="0,0,2,0" />
<Setter Property="HorizontalAlignment" Value="Left" /> <Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" /> <Setter Property="VerticalAlignment" Value="Center" />
@ -108,15 +108,15 @@
</Style> </Style>
<Style Selector="TabItem[TabStripPlacement=Top] /template/ Border#PART_SelectedPipe, TabItem[TabStripPlacement=Bottom] /template/ Border#PART_SelectedPipe"> <Style Selector="TabItem[TabStripPlacement=Top] /template/ Border#PART_SelectedPipe, TabItem[TabStripPlacement=Bottom] /template/ Border#PART_SelectedPipe">
<Setter Property="Height" Value="{StaticResource TabItemPipeThickness}" /> <Setter Property="Height" Value="{DynamicResource TabItemPipeThickness}" />
<Setter Property="Margin" Value="0,0,0,2" /> <Setter Property="Margin" Value="0,0,0,2" />
<Setter Property="HorizontalAlignment" Value="Stretch" /> <Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Bottom" /> <Setter Property="VerticalAlignment" Value="Bottom" />
</Style> </Style>
<Style Selector="TabItem[TabStripPlacement=Right] /template/ Border#PART_SelectedPipe"> <Style Selector="TabItem[TabStripPlacement=Right] /template/ Border#PART_SelectedPipe">
<Setter Property="Width" Value="{StaticResource TabItemPipeThickness}" /> <Setter Property="Width" Value="{DynamicResource TabItemPipeThickness}" />
<Setter Property="Height" Value="{StaticResource TabItemVerticalPipeHeight}" /> <Setter Property="Height" Value="{DynamicResource TabItemVerticalPipeHeight}" />
<Setter Property="Margin" Value="2,0,0,0" /> <Setter Property="Margin" Value="2,0,0,0" />
<Setter Property="HorizontalAlignment" Value="Right" /> <Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="VerticalAlignment" Value="Center" /> <Setter Property="VerticalAlignment" Value="Center" />

2
src/Avalonia.Themes.Fluent/Controls/TabStripItem.xaml

@ -57,7 +57,7 @@
<Setter Property="IsVisible" Value="False" /> <Setter Property="IsVisible" Value="False" />
</Style> </Style>
<Style Selector="TabStripItem /template/ Border#PART_SelectedPipe, TabItem[TabStripPlacement=Bottom] /template/ Border#PART_SelectedPipe"> <Style Selector="TabStripItem /template/ Border#PART_SelectedPipe, TabItem[TabStripPlacement=Bottom] /template/ Border#PART_SelectedPipe">
<Setter Property="Height" Value="{StaticResource TabStripItemPipeThickness}" /> <Setter Property="Height" Value="{DynamicResource TabStripItemPipeThickness}" />
<Setter Property="Margin" Value="0,0,0,2" /> <Setter Property="Margin" Value="0,0,0,2" />
<Setter Property="HorizontalAlignment" Value="Stretch" /> <Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Bottom" /> <Setter Property="VerticalAlignment" Value="Bottom" />

4
src/Avalonia.Themes.Fluent/Controls/TimePicker.xaml

@ -60,8 +60,8 @@
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
IsEnabled="{TemplateBinding IsEnabled}" IsEnabled="{TemplateBinding IsEnabled}"
MinWidth="{StaticResource TimePickerThemeMinWidth}" MinWidth="{DynamicResource TimePickerThemeMinWidth}"
MaxWidth="{StaticResource TimePickerThemeMaxWidth}" MaxWidth="{DynamicResource TimePickerThemeMaxWidth}"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
HorizontalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"
VerticalAlignment="Top" VerticalAlignment="Top"

2
src/Avalonia.Themes.Fluent/Controls/ToggleSwitch.xaml

@ -56,7 +56,7 @@
VerticalAlignment="Top"/> VerticalAlignment="Top"/>
<Grid Grid.Row="1" <Grid Grid.Row="1"
MinWidth="{StaticResource ToggleSwitchThemeMinWidth}" MinWidth="{DynamicResource ToggleSwitchThemeMinWidth}"
HorizontalAlignment="Left" HorizontalAlignment="Left"
VerticalAlignment="Top"> VerticalAlignment="Top">

Loading…
Cancel
Save