Browse Source

Default theme: Add ToggleSwitch resources

pull/4411/head
Maksym Katsydan 6 years ago
parent
commit
fdf4afd6ed
  1. 2
      src/Avalonia.Themes.Default/Accents/BaseDark.xaml
  2. 2
      src/Avalonia.Themes.Default/Accents/BaseLight.xaml
  3. 2
      src/Avalonia.Themes.Default/TabItem.xaml
  4. 45
      src/Avalonia.Themes.Default/ToggleSwitch.xaml
  5. 2
      src/Avalonia.Themes.Fluent/ToggleSwitch.xaml

2
src/Avalonia.Themes.Default/Accents/BaseDark.xaml

@ -58,6 +58,8 @@
<SolidColorBrush x:Key="NotificationCardWarningBackgroundBrush" Color="#FDB328" Opacity="0.75"/>
<SolidColorBrush x:Key="NotificationCardErrorBackgroundBrush" Color="#BD202C" Opacity="0.75"/>
<SolidColorBrush x:Key="ThemeControlTransparentBrush" Color="Transparent" />
<Thickness x:Key="ThemeBorderThickness">1,1,1,1</Thickness>
<sys:Double x:Key="ThemeDisabledOpacity">0.5</sys:Double>

2
src/Avalonia.Themes.Default/Accents/BaseLight.xaml

@ -61,6 +61,8 @@
<SolidColorBrush x:Key="NotificationCardWarningBackgroundBrush" Color="#FDB328" Opacity="0.75"/>
<SolidColorBrush x:Key="NotificationCardErrorBackgroundBrush" Color="#BD202C" Opacity="0.75"/>
<SolidColorBrush x:Key="ThemeControlTransparentBrush" Color="Transparent" />
<Thickness x:Key="ThemeBorderThickness">1</Thickness>
<sys:Double x:Key="ThemeDisabledOpacity">0.5</sys:Double>

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

@ -2,7 +2,7 @@
<Style Selector="TabItem">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="FontSize" Value="{DynamicResource FontSizeLarge}"/>
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundLightBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundLowBrush}"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="Padding" Value="8"/>
<Setter Property="Template">

45
src/Avalonia.Themes.Default/ToggleSwitch.xaml

@ -6,8 +6,40 @@
<GridLength x:Key="ToggleSwitchPreContentMargin">6</GridLength>
<GridLength x:Key="ToggleSwitchPostContentMargin">6</GridLength>
<x:Double x:Key="ToggleSwitchThemeMinWidth">154</x:Double>
<x:Double x:Key="KnobOnPosition">20</x:Double>
<x:Double x:Key="KnobOffPosition">0</x:Double>
<Thickness x:Key="ToggleSwitchOnStrokeThickness">0</Thickness>
<Thickness x:Key="ToggleSwitchOuterBorderStrokeThickness">1</Thickness>
<StaticResource x:Key="ToggleSwitchContentForeground" ResourceKey="ThemeForegroundBrush" />
<StaticResource x:Key="ToggleSwitchContentForegroundDisabled" ResourceKey="ThemeForegroundLowBrush" />
<StaticResource x:Key="ToggleSwitchHeaderForeground" ResourceKey="ThemeForegroundBrush" />
<StaticResource x:Key="ToggleSwitchHeaderForegroundDisabled" ResourceKey="ThemeForegroundLowBrush" />
<StaticResource x:Key="ToggleSwitchContainerBackground" ResourceKey="ThemeControlTransparentBrush" />
<StaticResource x:Key="ToggleSwitchContainerBackgroundPointerOver" ResourceKey="ThemeControlTransparentBrush" />
<StaticResource x:Key="ToggleSwitchContainerBackgroundPressed" ResourceKey="ThemeControlTransparentBrush" />
<StaticResource x:Key="ToggleSwitchContainerBackgroundDisabled" ResourceKey="ThemeControlTransparentBrush" />
<StaticResource x:Key="ToggleSwitchFillOff" ResourceKey="ThemeControlTransparentBrush" />
<StaticResource x:Key="ToggleSwitchFillOffPointerOver" ResourceKey="ThemeControlTransparentBrush" />
<StaticResource x:Key="ToggleSwitchFillOffPressed" ResourceKey="ThemeControlMidHighBrush" />
<StaticResource x:Key="ToggleSwitchFillOffDisabled" ResourceKey="ThemeControlTransparentBrush" />
<StaticResource x:Key="ToggleSwitchStrokeOff" ResourceKey="ThemeBorderMidBrush" />
<StaticResource x:Key="ToggleSwitchStrokeOffPointerOver" ResourceKey="ThemeBorderHighBrush" />
<StaticResource x:Key="ToggleSwitchStrokeOffPressed" ResourceKey="ThemeBorderHighBrush" />
<StaticResource x:Key="ToggleSwitchStrokeOffDisabled" ResourceKey="ThemeForegroundLowBrush" />
<StaticResource x:Key="ToggleSwitchFillOn" ResourceKey="ThemeAccentBrush" />
<StaticResource x:Key="ToggleSwitchFillOnPointerOver" ResourceKey="ThemeAccentBrush2" />
<StaticResource x:Key="ToggleSwitchFillOnPressed" ResourceKey="ThemeAccentBrush3" />
<StaticResource x:Key="ToggleSwitchFillOnDisabled" ResourceKey="ThemeForegroundLowBrush" />
<StaticResource x:Key="ToggleSwitchStrokeOn" ResourceKey="ThemeAccentBrush" />
<StaticResource x:Key="ToggleSwitchStrokeOnPointerOver" ResourceKey="ThemeAccentBrush2" />
<StaticResource x:Key="ToggleSwitchStrokeOnPressed" ResourceKey="ThemeAccentBrush3" />
<StaticResource x:Key="ToggleSwitchStrokeOnDisabled" ResourceKey="ThemeForegroundLowBrush" />
<StaticResource x:Key="ToggleSwitchKnobFillOff" ResourceKey="ThemeBorderMidBrush" />
<StaticResource x:Key="ToggleSwitchKnobFillOffPointerOver" ResourceKey="ThemeBorderHighBrush" />
<StaticResource x:Key="ToggleSwitchKnobFillOffPressed" ResourceKey="ThemeBorderHighBrush" />
<StaticResource x:Key="ToggleSwitchKnobFillOffDisabled" ResourceKey="ThemeForegroundLowBrush" />
<StaticResource x:Key="ToggleSwitchKnobFillOn" ResourceKey="HighlightForegroundBrush" />
<StaticResource x:Key="ToggleSwitchKnobFillOnPointerOver" ResourceKey="HighlightForegroundBrush" />
<StaticResource x:Key="ToggleSwitchKnobFillOnPressed" ResourceKey="HighlightForegroundBrush" />
<StaticResource x:Key="ToggleSwitchKnobFillOnDisabled" ResourceKey="HighlightForegroundBrush" />
</Styles.Resources>
<Design.PreviewWith>
<StackPanel Margin="20" Width="250" Spacing="24" >
@ -155,7 +187,6 @@
</Style>
<Style Selector="ToggleSwitch /template/ Grid#MovingKnobs">
<Setter Property="Canvas.Left" Value="{DynamicResource KnobOffPosition}"/>
<Setter Property="Transitions">
<Transitions>
<DoubleTransition Property="Canvas.Left" Duration="0:0:0.2" Easing="CubicEaseOut"/>
@ -233,10 +264,6 @@
</Style>
<!-- CheckedState -->
<Style Selector="ToggleSwitch:checked /template/ Grid#MovingKnobs">
<Setter Property="Canvas.Left" Value="{DynamicResource KnobOnPosition}"/>
</Style>
<Style Selector="ToggleSwitch:checked /template/ Border#OuterBorder">
<Setter Property="Opacity" Value="0"/>
</Style>
@ -262,10 +289,6 @@
</Style>
<!--UncheckedState -->
<Style Selector="ToggleSwitch:unchecked /template/ Grid#MovingKnobs">
<Setter Property="Canvas.Left" Value="{DynamicResource KnobOffPosition}"/>
</Style>
<Style Selector="ToggleSwitch:unchecked /template/ Border#OuterBorder">
<Setter Property="Opacity" Value="1"/>
</Style>

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

@ -6,8 +6,6 @@
<GridLength x:Key="ToggleSwitchPreContentMargin">6</GridLength>
<GridLength x:Key="ToggleSwitchPostContentMargin">6</GridLength>
<x:Double x:Key="ToggleSwitchThemeMinWidth">154</x:Double>
<x:Double x:Key="KnobOnPosition">20</x:Double>
<x:Double x:Key="KnobOffPosition">0</x:Double>
</Styles.Resources>
<Design.PreviewWith>
<StackPanel Margin="20" Width="250" Spacing="24" >

Loading…
Cancel
Save