Browse Source

Adding Defauld values and change OuterBorderWidth

pull/4069/head
JamRemco 6 years ago
parent
commit
b18b70b82e
  1. 4
      src/Avalonia.Controls/ToggleSwitch.cs
  2. 2
      src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml
  3. 2
      src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml
  4. 17
      src/Avalonia.Themes.Fluent/ToggleSwitch.xaml

4
src/Avalonia.Controls/ToggleSwitch.cs

@ -15,14 +15,14 @@ namespace Avalonia.Controls
public class ToggleSwitch : ToggleButton
{
public static readonly StyledProperty<object> OffContentProperty =
AvaloniaProperty.Register<ToggleSwitch, object>(nameof(OffContent));
AvaloniaProperty.Register<ToggleSwitch, object>(nameof(OffContent), defaultValue:"Off");
public static readonly StyledProperty<IDataTemplate> OffContentTemplateProperty =
AvaloniaProperty.Register<ToggleSwitch, IDataTemplate>(nameof(OffContentTemplate));
public static readonly StyledProperty<object> OnContentProperty =
AvaloniaProperty.Register<ToggleSwitch, object>(nameof(OnContent));
AvaloniaProperty.Register<ToggleSwitch, object>(nameof(OnContent), defaultValue: "On");
public static readonly StyledProperty<IDataTemplate> OnContentTemplateProperty =
AvaloniaProperty.Register<ToggleSwitch, IDataTemplate>(nameof(OnContentTemplate));

2
src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml

@ -349,7 +349,7 @@
<!--<x:Double x:Key="ToggleSwitchOnStrokeThickness">0</x:Double>-->
<Thickness x:Key="ToggleSwitchOnStrokeThickness">0</Thickness>
<!--<x:Double x:Key="ToggleSwitchOuterBorderStrokeThickness">1</x:Double>-->
<Thickness x:Key="ToggleSwitchOuterBorderStrokeThickness">1.5</Thickness>
<Thickness x:Key="ToggleSwitchOuterBorderStrokeThickness">1</Thickness>
<StaticResource x:Key="ToggleSwitchContentForeground" ResourceKey="SystemControlForegroundBaseHighBrush" />
<StaticResource x:Key="ToggleSwitchContentForegroundDisabled" ResourceKey="SystemControlDisabledBaseMediumLowBrush" />
<StaticResource x:Key="ToggleSwitchHeaderForeground" ResourceKey="SystemControlForegroundBaseHighBrush" />

2
src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml

@ -350,7 +350,7 @@
<Thickness x:Key="ToggleSwitchOnStrokeThickness">0</Thickness>
<!--<x:Double x:Key="ToggleSwitchOuterBorderStrokeThickness">1</x:Double>-->
<Thickness x:Key="ToggleSwitchOuterBorderStrokeThickness">1.5</Thickness>
<Thickness x:Key="ToggleSwitchOuterBorderStrokeThickness">1</Thickness>
<StaticResource x:Key="ToggleSwitchContentForeground" ResourceKey="SystemControlForegroundBaseHighBrush" />
<StaticResource x:Key="ToggleSwitchContentForegroundDisabled" ResourceKey="SystemControlDisabledBaseMediumLowBrush" />
<StaticResource x:Key="ToggleSwitchHeaderForeground" ResourceKey="SystemControlForegroundBaseHighBrush" />

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

@ -13,11 +13,12 @@
<TextBlock
Text="Updates will be automaticly Downloaded and installed shile the computer is shutting down or restarting"
TextWrapping="Wrap"/>
<ToggleSwitch
<ToggleSwitch HorizontalContentAlignment="Left"
Content="Enable automatic Updates?"
OffContent="Uit"
OnContent="Aan"
VerticalAlignment="Bottom" />
VerticalAlignment="Bottom"
/>
</StackPanel>
<StackPanel Spacing="12">
@ -28,7 +29,7 @@
Text="The previewer Shows a preview off your code, this could slow down your system"
TextWrapping="Wrap"/>
<ToggleSwitch
OnContent="Yes" OffContent="No"
Content="Previewer"
IsChecked="True"
/>
@ -100,15 +101,15 @@
<Border x:Name="OuterBorder"
Grid.Row="1"
Height="20"
Width="42"
CornerRadius="10"
Width="40"
CornerRadius="100"
BorderThickness="{DynamicResource ToggleSwitchOuterBorderStrokeThickness}" />
<Border x:Name="SwitchKnobBounds"
Grid.Row="1"
Height="20"
Width="42"
CornerRadius="10"
Width="40"
CornerRadius="100"
BorderThickness="{DynamicResource ToggleSwitchOnStrokeThickness}"/>
<Canvas x:Name="SwitchKnob"
@ -335,7 +336,7 @@
<x:Double x:Key="ToggleSwitchPreContentMargin">6</x:Double>
<x:Double x:Key="ToggleSwitchPostContentMargin">6</x:Double>
<x:Double x:Key="ToggleSwitchThemeMinWidth">154</x:Double>
<x:Double x:Key="KnobOnPosition">22</x:Double>
<x:Double x:Key="KnobOnPosition">20</x:Double>
<x:Double x:Key="KnobOffPosition">0</x:Double>
</Styles.Resources>

Loading…
Cancel
Save