8 changed files with 414 additions and 0 deletions
@ -0,0 +1,11 @@ |
|||
using Avalonia.Controls.Primitives; |
|||
|
|||
namespace Avalonia.Controls |
|||
{ |
|||
/// <summary>
|
|||
/// A check box control.
|
|||
/// </summary>
|
|||
public class ToggleSwitch : ToggleButton |
|||
{ |
|||
} |
|||
} |
|||
@ -0,0 +1,188 @@ |
|||
<Styles xmlns="https://github.com/avaloniaui" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
|||
|
|||
<Design.PreviewWith> |
|||
<StackPanel Margin="20" Width="200" Spacing="8"> |
|||
<TextBlock |
|||
Text="Automatic updates" |
|||
Classes="h1"/> |
|||
<TextBlock |
|||
Text="Updates will be automaticly Foenloaded and installed when shutdown down" |
|||
TextWrapping="Wrap"/> |
|||
<ToggleSwitch Content="Updates" |
|||
FontWeight="Medium" |
|||
VerticalAlignment="Bottom"/> |
|||
<TextBlock |
|||
Text="Previewer" |
|||
Classes="h1"/> |
|||
<TextBlock |
|||
Text="The previewer Shows a representation off your code, this could slow down your system" |
|||
TextWrapping="Wrap"/> |
|||
<ToggleSwitch |
|||
Content="Previewer" |
|||
IsChecked="True" |
|||
FontWeight="Medium"/> |
|||
</StackPanel> |
|||
</Design.PreviewWith> |
|||
|
|||
<Style Selector="ToggleSwitch" > |
|||
|
|||
<Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" /> |
|||
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" /> |
|||
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" /> |
|||
<Setter Property="MinWidth" Value="72"/> |
|||
<Setter Property="MinHeight" Value="32"/> |
|||
<Setter Property="Template"> |
|||
<ControlTemplate> |
|||
<Grid ColumnDefinitions="Auto,*" |
|||
RowDefinitions="18,auto" |
|||
> |
|||
<Canvas |
|||
Height="24" |
|||
Grid.Row="1" |
|||
Grid.Column="0"> |
|||
|
|||
<Border |
|||
Name="PART_BorderBackground" |
|||
Height="20" Width="44" |
|||
Canvas.Top="2" |
|||
Canvas.Left="0" |
|||
BorderThickness="2" |
|||
CornerRadius="100"/> |
|||
|
|||
<Ellipse |
|||
Name="PART_CircleThumb" |
|||
Height="10" Width="10" |
|||
Canvas.Top="7" |
|||
Canvas.Left="5"/> |
|||
|
|||
<ContentControl Name="PART_TextBooleanValue" |
|||
Canvas.Left="51" VerticalContentAlignment="Bottom" Height="20"/> |
|||
|
|||
</Canvas> |
|||
|
|||
<ContentPresenter |
|||
Name="PART_ContentPresenter" |
|||
ContentTemplate="{TemplateBinding ContentTemplate}" |
|||
Content="{TemplateBinding Content}" |
|||
Margin="{TemplateBinding Padding}" |
|||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" |
|||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" |
|||
Background="Transparent" |
|||
IsVisible="{TemplateBinding Content, Converter={x:Static ObjectConverters.IsNotNull}}" |
|||
Grid.Row="0" Grid.Column="0"/> |
|||
</Grid> |
|||
</ControlTemplate> |
|||
</Setter> |
|||
|
|||
</Style> |
|||
|
|||
|
|||
<Style Selector="ToggleSwitch:unchecked /template/ Ellipse#PART_CircleThumb"> |
|||
<Style.Animations> |
|||
<Animation Duration="0:0:0.4" FillMode="Forward" Easing="CubicEaseOut"> |
|||
<KeyFrame Cue="0%"> |
|||
<Setter Property="Fill" Value="White"/> |
|||
<Setter Property="Canvas.Left" Value="28"/> |
|||
</KeyFrame> |
|||
<KeyFrame Cue="100%"> |
|||
<Setter Property="Fill" Value="RoyalBlue"/> |
|||
<Setter Property="Canvas.Left" Value="5"/> |
|||
</KeyFrame> |
|||
</Animation> |
|||
</Style.Animations> |
|||
</Style> |
|||
|
|||
<Style Selector="ToggleSwitch:checked /template/ Ellipse#PART_CircleThumb"> |
|||
<Style.Animations> |
|||
<Animation Duration="0:0:0.4" FillMode="Forward" Easing="CubicEaseOut"> |
|||
<KeyFrame Cue="0%"> |
|||
<Setter Property="Fill" Value="RoyalBlue"/> |
|||
<Setter Property="Canvas.Left" Value="5"/> |
|||
</KeyFrame> |
|||
<KeyFrame Cue="100%"> |
|||
<Setter Property="Fill" Value="White"/> |
|||
<Setter Property="Canvas.Left" Value="28"/> |
|||
</KeyFrame> |
|||
</Animation> |
|||
</Style.Animations> |
|||
</Style> |
|||
|
|||
<Style Selector="ToggleSwitch:unchecked /template/ Border#PART_BorderBackground"> |
|||
<Style.Animations> |
|||
<Animation Duration="0:0:0.5" FillMode="Forward" Easing="CubicEaseOut"> |
|||
<KeyFrame Cue="0%"> |
|||
<Setter Property="Background" Value="Royalblue"/> |
|||
</KeyFrame> |
|||
<KeyFrame Cue="100%"> |
|||
<Setter Property="Background" Value="White"/> |
|||
</KeyFrame> |
|||
</Animation> |
|||
</Style.Animations> |
|||
<Setter Property="BorderBrush" Value="Silver"/> |
|||
</Style> |
|||
|
|||
<Style Selector="ToggleSwitch:checked /template/ Border#PART_BorderBackground"> |
|||
<Style.Animations> |
|||
<Animation Duration="0:0:0.5" FillMode="Forward" Easing="CubicEaseOut"> |
|||
<KeyFrame Cue="0%"> |
|||
<Setter Property="Background" Value="White"/> |
|||
</KeyFrame> |
|||
<KeyFrame Cue="100%"> |
|||
<Setter Property="Background" Value="RoyalBlue"/> |
|||
</KeyFrame> |
|||
</Animation> |
|||
</Style.Animations> |
|||
<Setter Property="BorderBrush" Value="Royalblue"/> |
|||
</Style> |
|||
|
|||
<Style Selector="ToggleSwitch:pressed /template/ Border#PART_BorderBackground"> |
|||
<Setter Property="BorderBrush" Value="{DynamicResource ThemeControlHighBrush}"/> |
|||
</Style> |
|||
|
|||
<Style Selector="ToggleSwitch:checked /template/ ContentControl#PART_TextBooleanValue"> |
|||
<Setter Property="Content" Value="On"/> |
|||
</Style> |
|||
|
|||
<Style Selector="ToggleSwitch:unchecked /template/ ContentControl#PART_TextBooleanValue"> |
|||
<Setter Property="Content" Value="Off"/> |
|||
</Style> |
|||
|
|||
<Style Selector="ToggleSwitch /template/ Border#PART_BorderBackground:pointerover"> |
|||
<Setter Property="BorderBrush" Value="cornflowerblue"/> |
|||
</Style> |
|||
|
|||
<Style Selector="ToggleSwitch:focus /template/ Border#PART_BorderBackground"> |
|||
<Setter Property="BorderBrush" Value="Mediumblue"/> |
|||
</Style> |
|||
|
|||
<Style Selector="ToggleSwitch:focus:checked /template/ Border#PART_BorderBackground"> |
|||
<Setter Property="Background" Value="RoyalBlue"/> |
|||
</Style> |
|||
|
|||
<Style Selector="ToggleSwitch:focus /template/ Border#PART_BorderBackground:pointerover"> |
|||
<Setter Property="BorderBrush" Value="cornflowerblue"/> |
|||
</Style> |
|||
|
|||
<!--<Style Selector="ToggleSwitch:checked /template/ Border#PART_BorderBackground:pointerover"> |
|||
<Style.Animations> |
|||
<Animation Duration="0:0:0.1" FillMode="Forward" Easing="CubicEaseOut"> |
|||
<KeyFrame Cue="0%"> |
|||
<Setter Property="Background" Value="Royalblue"/> |
|||
</KeyFrame> |
|||
<KeyFrame Cue="100%"> |
|||
<Setter Property="Background" Value="cornflowerblue"/> |
|||
</KeyFrame> |
|||
</Animation> |
|||
</Style.Animations> |
|||
</Style>--> |
|||
|
|||
<Style Selector="ToggleSwitch:disabled"> |
|||
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}"/> |
|||
</Style> |
|||
|
|||
|
|||
<!--<Style Selector="ToggleSwitch:indeterminate /template/ ContentControl#PART_TextBooleanValue"> |
|||
<Setter Property="Content" Value="Not set"/> |
|||
</Style>--> |
|||
</Styles> |
|||
@ -0,0 +1,194 @@ |
|||
<Styles xmlns="https://github.com/avaloniaui" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
|||
|
|||
<Design.PreviewWith> |
|||
<StackPanel Margin="20" Width="200" Spacing="24"> |
|||
<StackPanel Spacing="8"> |
|||
<TextBlock |
|||
Text="Automatic updates" |
|||
Classes="h1"/> |
|||
<TextBlock |
|||
Text="Updates will be automaticly Downloaded and installed when shutdown down" |
|||
TextWrapping="Wrap"/> |
|||
<ToggleSwitch Content="Updates" |
|||
FontWeight="Medium" |
|||
VerticalAlignment="Bottom"/> |
|||
</StackPanel> |
|||
|
|||
<StackPanel Spacing="8"> |
|||
<TextBlock |
|||
Text="Previewer" |
|||
Classes="h1"/> |
|||
<TextBlock |
|||
Text="The previewer Shows a preview off your code, this could slow down your system" |
|||
TextWrapping="Wrap"/> |
|||
<ToggleSwitch |
|||
Content="Previewer" |
|||
IsChecked="True" |
|||
FontWeight="Medium"/> |
|||
</StackPanel> |
|||
|
|||
</StackPanel> |
|||
</Design.PreviewWith> |
|||
|
|||
<Style Selector="ToggleSwitch" > |
|||
|
|||
<Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" /> |
|||
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" /> |
|||
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" /> |
|||
<Setter Property="MinWidth" Value="72"/> |
|||
<Setter Property="MinHeight" Value="32"/> |
|||
<Setter Property="Template"> |
|||
<ControlTemplate> |
|||
<Grid ColumnDefinitions="Auto,*" |
|||
RowDefinitions="18,auto" |
|||
> |
|||
<Canvas |
|||
Height="24" |
|||
Grid.Row="1" |
|||
Grid.Column="0"> |
|||
|
|||
<Border |
|||
Name="PART_BorderBackground" |
|||
Height="20" Width="44" |
|||
Canvas.Top="2" |
|||
Canvas.Left="0" |
|||
BorderThickness="2" |
|||
CornerRadius="100"/> |
|||
|
|||
<Ellipse |
|||
Name="PART_CircleThumb" |
|||
Height="10" Width="10" |
|||
Canvas.Top="7" |
|||
Canvas.Left="5"/> |
|||
|
|||
<ContentControl Name="PART_TextBooleanValue" |
|||
Canvas.Left="51" VerticalContentAlignment="Bottom" Height="20"/> |
|||
|
|||
</Canvas> |
|||
|
|||
<ContentPresenter |
|||
Name="PART_ContentPresenter" |
|||
ContentTemplate="{TemplateBinding ContentTemplate}" |
|||
Content="{TemplateBinding Content}" |
|||
Margin="{TemplateBinding Padding}" |
|||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" |
|||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" |
|||
Background="Transparent" |
|||
IsVisible="{TemplateBinding Content, Converter={x:Static ObjectConverters.IsNotNull}}" |
|||
Grid.Row="0" Grid.Column="0"/> |
|||
</Grid> |
|||
</ControlTemplate> |
|||
</Setter> |
|||
|
|||
</Style> |
|||
|
|||
|
|||
<Style Selector="ToggleSwitch:unchecked /template/ Ellipse#PART_CircleThumb"> |
|||
<Style.Animations> |
|||
<Animation Duration="0:0:0.4" FillMode="Forward" Easing="CubicEaseOut"> |
|||
<KeyFrame Cue="0%"> |
|||
<Setter Property="Fill" Value="White"/> |
|||
<Setter Property="Canvas.Left" Value="28"/> |
|||
</KeyFrame> |
|||
<KeyFrame Cue="100%"> |
|||
<Setter Property="Fill" Value="RoyalBlue"/> |
|||
<Setter Property="Canvas.Left" Value="5"/> |
|||
</KeyFrame> |
|||
</Animation> |
|||
</Style.Animations> |
|||
</Style> |
|||
|
|||
<Style Selector="ToggleSwitch:checked /template/ Ellipse#PART_CircleThumb"> |
|||
<Style.Animations> |
|||
<Animation Duration="0:0:0.4" FillMode="Forward" Easing="CubicEaseOut"> |
|||
<KeyFrame Cue="0%"> |
|||
<Setter Property="Fill" Value="RoyalBlue"/> |
|||
<Setter Property="Canvas.Left" Value="5"/> |
|||
</KeyFrame> |
|||
<KeyFrame Cue="100%"> |
|||
<Setter Property="Fill" Value="White"/> |
|||
<Setter Property="Canvas.Left" Value="28"/> |
|||
</KeyFrame> |
|||
</Animation> |
|||
</Style.Animations> |
|||
</Style> |
|||
|
|||
<Style Selector="ToggleSwitch:unchecked /template/ Border#PART_BorderBackground"> |
|||
<Style.Animations> |
|||
<Animation Duration="0:0:0.5" FillMode="Forward" Easing="CubicEaseOut"> |
|||
<KeyFrame Cue="0%"> |
|||
<Setter Property="Background" Value="Royalblue"/> |
|||
</KeyFrame> |
|||
<KeyFrame Cue="100%"> |
|||
<Setter Property="Background" Value="White"/> |
|||
</KeyFrame> |
|||
</Animation> |
|||
</Style.Animations> |
|||
<Setter Property="BorderBrush" Value="Silver"/> |
|||
</Style> |
|||
|
|||
<Style Selector="ToggleSwitch:checked /template/ Border#PART_BorderBackground"> |
|||
<Style.Animations> |
|||
<Animation Duration="0:0:0.5" FillMode="Forward" Easing="CubicEaseOut"> |
|||
<KeyFrame Cue="0%"> |
|||
<Setter Property="Background" Value="White"/> |
|||
</KeyFrame> |
|||
<KeyFrame Cue="100%"> |
|||
<Setter Property="Background" Value="RoyalBlue"/> |
|||
</KeyFrame> |
|||
</Animation> |
|||
</Style.Animations> |
|||
<Setter Property="BorderBrush" Value="Royalblue"/> |
|||
</Style> |
|||
|
|||
<Style Selector="ToggleSwitch:pressed /template/ Border#PART_BorderBackground"> |
|||
<Setter Property="BorderBrush" Value="{DynamicResource ThemeControlHighBrush}"/> |
|||
</Style> |
|||
|
|||
<Style Selector="ToggleSwitch:checked /template/ ContentControl#PART_TextBooleanValue"> |
|||
<Setter Property="Content" Value="On"/> |
|||
</Style> |
|||
|
|||
<Style Selector="ToggleSwitch:unchecked /template/ ContentControl#PART_TextBooleanValue"> |
|||
<Setter Property="Content" Value="Off"/> |
|||
</Style> |
|||
|
|||
<Style Selector="ToggleSwitch /template/ Border#PART_BorderBackground:pointerover"> |
|||
<Setter Property="BorderBrush" Value="cornflowerblue"/> |
|||
</Style> |
|||
|
|||
<Style Selector="ToggleSwitch:focus /template/ Border#PART_BorderBackground"> |
|||
<Setter Property="BorderBrush" Value="Mediumblue"/> |
|||
</Style> |
|||
|
|||
<Style Selector="ToggleSwitch:focus:checked /template/ Border#PART_BorderBackground"> |
|||
<Setter Property="Background" Value="RoyalBlue"/> |
|||
</Style> |
|||
|
|||
<Style Selector="ToggleSwitch:focus /template/ Border#PART_BorderBackground:pointerover"> |
|||
<Setter Property="BorderBrush" Value="cornflowerblue"/> |
|||
</Style> |
|||
|
|||
<!--<Style Selector="ToggleSwitch:checked /template/ Border#PART_BorderBackground:pointerover"> |
|||
<Style.Animations> |
|||
<Animation Duration="0:0:0.1" FillMode="Forward" Easing="CubicEaseOut"> |
|||
<KeyFrame Cue="0%"> |
|||
<Setter Property="Background" Value="Royalblue"/> |
|||
</KeyFrame> |
|||
<KeyFrame Cue="100%"> |
|||
<Setter Property="Background" Value="cornflowerblue"/> |
|||
</KeyFrame> |
|||
</Animation> |
|||
</Style.Animations> |
|||
</Style>--> |
|||
|
|||
<Style Selector="ToggleSwitch:disabled"> |
|||
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}"/> |
|||
</Style> |
|||
|
|||
|
|||
<!--<Style Selector="ToggleSwitch:indeterminate /template/ ContentControl#PART_TextBooleanValue"> |
|||
<Setter Property="Content" Value="Not set"/> |
|||
</Style>--> |
|||
</Styles> |
|||
Loading…
Reference in new issue