chore: add avalonia ToggleButton demo.

This commit is contained in:
NaBian committed 2024-12-01 20:37:37 +08:00
1 parent 4713903b54
commit 00d64d55a0
17 files changed
+1564 -242

No files matched your search

@@ -0,0 +1,602 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="HandyControlDemo.UserControl.ToggleButtonDemoCtl"
xmlns:hc="https://handyorg.github.io/handycontrol"
Background="{DynamicResource RegionBrush}">
<ScrollViewer>
<hc:UniformSpacingPanel ChildWrapping="Wrap"
Spacing="32"
Margin="32">
<hc:UniformSpacingPanel Orientation="Vertical"
Spacing="32">
<WrapPanel>
<StackPanel>
<ToggleButton IsChecked="True"
Content="Default"
Margin="5" />
<ToggleButton IsEnabled="False"
IsChecked="True"
Content="Default"
Margin="5" />
</StackPanel>
<StackPanel>
<ToggleButton IsChecked="True"
Content="Primary"
Margin="5"
Theme="{StaticResource ToggleButtonPrimary}" />
<ToggleButton IsEnabled="False"
IsChecked="True"
Content="Primary"
Margin="5"
Theme="{StaticResource ToggleButtonPrimary}" />
</StackPanel>
<StackPanel>
<ToggleButton IsChecked="True"
Content="Success"
Margin="5"
Theme="{StaticResource ToggleButtonSuccess}" />
<ToggleButton IsEnabled="False"
IsChecked="True"
Content="Success"
Margin="5"
Theme="{StaticResource ToggleButtonSuccess}" />
</StackPanel>
<StackPanel>
<ToggleButton Content="Info"
Margin="5"
Theme="{StaticResource ToggleButtonInfo}" />
<ToggleButton IsEnabled="False"
Content="Info"
Margin="5"
Theme="{StaticResource ToggleButtonInfo}" />
</StackPanel>
<StackPanel>
<ToggleButton Content="Warning"
Margin="5"
Theme="{StaticResource ToggleButtonWarning}" />
<ToggleButton IsEnabled="False"
Content="Warning"
Margin="5"
Theme="{StaticResource ToggleButtonWarning}" />
</StackPanel>
<StackPanel>
<ToggleButton Content="Danger"
Margin="5"
Theme="{StaticResource ToggleButtonDanger}" />
<ToggleButton IsEnabled="False"
Content="Danger"
Margin="5"
Theme="{StaticResource ToggleButtonDanger}" />
</StackPanel>
</WrapPanel>
<WrapPanel>
<StackPanel>
<ToggleButton IsChecked="True"
Content="Clock"
Margin="5"
hc:IconElement.Geometry="{StaticResource ClockGeometry}" />
<ToggleButton IsChecked="True"
Content="Clock"
IsEnabled="False"
Margin="5"
hc:IconElement.Geometry="{StaticResource ClockGeometry}" />
</StackPanel>
<StackPanel>
<ToggleButton IsChecked="True"
Content="Calendar"
Margin="5"
Theme="{StaticResource ToggleButtonPrimary}"
hc:IconElement.Geometry="{StaticResource CalendarGeometry}" />
<ToggleButton IsChecked="True"
Content="Calendar"
IsEnabled="False"
Margin="5"
Theme="{StaticResource ToggleButtonPrimary}"
hc:IconElement.Geometry="{StaticResource CalendarGeometry}" />
</StackPanel>
<StackPanel>
<ToggleButton IsChecked="True"
Margin="5"
Theme="{StaticResource ToggleButtonSuccess}"
hc:IconElement.Geometry="{StaticResource RotateLeftGeometry}" />
<ToggleButton IsChecked="True"
IsEnabled="False"
Margin="5"
Theme="{StaticResource ToggleButtonSuccess}"
hc:IconElement.Geometry="{StaticResource RotateLeftGeometry}" />
</StackPanel>
<StackPanel>
<ToggleButton Margin="5"
Theme="{StaticResource ToggleButtonInfo}"
hc:IconElement.Geometry="{StaticResource RotateRightGeometry}" />
<ToggleButton IsEnabled="False"
Margin="5"
Theme="{StaticResource ToggleButtonInfo}"
hc:IconElement.Geometry="{StaticResource RotateRightGeometry}" />
</StackPanel>
<StackPanel>
<ToggleButton Margin="5"
Theme="{StaticResource ToggleButtonWarning}"
hc:IconElement.Geometry="{StaticResource LeftGeometry}" />
<ToggleButton IsEnabled="False"
Margin="5"
Theme="{StaticResource ToggleButtonWarning}"
hc:IconElement.Geometry="{StaticResource LeftGeometry}" />
</StackPanel>
<StackPanel>
<ToggleButton Margin="5"
Theme="{StaticResource ToggleButtonDanger}"
hc:IconElement.Geometry="{StaticResource RightGeometry}" />
<ToggleButton IsEnabled="False"
Margin="5"
Theme="{StaticResource ToggleButtonDanger}"
hc:IconElement.Geometry="{StaticResource RightGeometry}" />
</StackPanel>
</WrapPanel>
<WrapPanel>
<StackPanel>
<ToggleButton IsChecked="True"
Margin="5"
Theme="{StaticResource ToggleButtonIcon}"
hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}"
hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}" />
<ToggleButton IsChecked="True"
IsEnabled="False"
Margin="5"
Theme="{StaticResource ToggleButtonIcon}"
hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}"
hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}" />
</StackPanel>
<StackPanel>
<ToggleButton IsChecked="True"
Margin="5"
Theme="{StaticResource ToggleButtonIconPrimary}"
hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}"
hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}" />
<ToggleButton IsChecked="True"
IsEnabled="False"
Margin="5"
Theme="{StaticResource ToggleButtonIconPrimary}"
hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}"
hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}" />
</StackPanel>
<StackPanel>
<ToggleButton IsChecked="True"
Margin="5"
Theme="{StaticResource ToggleButtonIconSuccess}"
hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}"
hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}" />
<ToggleButton IsChecked="True"
IsEnabled="False"
Margin="5"
Theme="{StaticResource ToggleButtonIconSuccess}"
hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}"
hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}" />
</StackPanel>
<StackPanel>
<ToggleButton Margin="5"
Theme="{StaticResource ToggleButtonIconInfo}"
hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}"
hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}" />
<ToggleButton IsEnabled="False"
Margin="5"
Theme="{StaticResource ToggleButtonIconInfo}"
hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}"
hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}" />
</StackPanel>
<StackPanel>
<ToggleButton Margin="5"
Theme="{StaticResource ToggleButtonIconWarning}"
hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}"
hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}" />
<ToggleButton IsEnabled="False"
Margin="5"
Theme="{StaticResource ToggleButtonIconWarning}"
hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}"
hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}" />
</StackPanel>
<StackPanel>
<ToggleButton Margin="5"
Theme="{StaticResource ToggleButtonIconDanger}"
hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}"
hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}" />
<ToggleButton IsEnabled="False"
Margin="5"
Theme="{StaticResource ToggleButtonIconDanger}"
hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}"
hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}" />
</StackPanel>
</WrapPanel>
<WrapPanel>
<StackPanel>
<ToggleButton Margin="5"
Theme="{StaticResource ToggleButtonIconTransparent}"
hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}"
hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}" />
<ToggleButton IsEnabled="False"
Margin="5"
Theme="{StaticResource ToggleButtonIconTransparent}"
hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}"
hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}" />
</StackPanel>
<StackPanel>
<ToggleButton IsChecked="True"
Theme="{StaticResource ToggleButtonCustom}"
hc:StatusSwitchElement.HideUncheckedElement="True"
Margin="5">
<hc:StatusSwitchElement.CheckedElement>
<Border Width="80"
Height="30"
CornerRadius="4"
BorderThickness="1"
BorderBrush="{DynamicResource BorderBrush}">
<Ellipse Width="20"
Height="20"
Fill="{DynamicResource PrimaryBrush}"
StrokeThickness="1"
Stroke="{DynamicResource BorderBrush}" />
</Border>
</hc:StatusSwitchElement.CheckedElement>
<Border Width="80"
Height="30"
CornerRadius="4"
BorderThickness="1"
BorderBrush="{DynamicResource BorderBrush}">
<Ellipse Width="20"
Height="20"
Fill="{DynamicResource BorderBrush}"
StrokeThickness="1"
Stroke="{DynamicResource BorderBrush}" />
</Border>
</ToggleButton>
<ToggleButton IsEnabled="False"
IsChecked="True"
Theme="{StaticResource ToggleButtonCustom}"
hc:StatusSwitchElement.HideUncheckedElement="True"
Margin="5">
<hc:StatusSwitchElement.CheckedElement>
<Border Width="80"
Height="30"
CornerRadius="4"
BorderThickness="1"
BorderBrush="{DynamicResource BorderBrush}">
<Ellipse Width="20"
Height="20"
Fill="{DynamicResource PrimaryBrush}"
StrokeThickness="1"
Stroke="{DynamicResource BorderBrush}" />
</Border>
</hc:StatusSwitchElement.CheckedElement>
<Border Width="80"
Height="30"
CornerRadius="4"
BorderThickness="1"
BorderBrush="{DynamicResource BorderBrush}">
<Ellipse Width="20"
Height="20"
Fill="{DynamicResource BorderBrush}"
StrokeThickness="1"
Stroke="{DynamicResource BorderBrush}" />
</Border>
</ToggleButton>
</StackPanel>
<StackPanel VerticalAlignment="Center">
<ToggleButton IsChecked="True"
Margin="5"
HorizontalAlignment="Center"
Theme="{StaticResource ToggleButtonSwitch}"
hc:VisualElement.HighlightBrush="{DynamicResource DangerBrush}" />
<ToggleButton IsEnabled="False"
IsChecked="True"
HorizontalAlignment="Center"
Margin="5"
Theme="{StaticResource ToggleButtonSwitch}" />
</StackPanel>
<StackPanel VerticalAlignment="Center">
<ToggleButton hc:ToggleButtonAttach.ShowLabel="True"
Content="Switch"
Margin="5"
HorizontalAlignment="Center"
Theme="{StaticResource ToggleButtonSwitch}"
hc:VisualElement.HighlightBrush="{DynamicResource DangerBrush}" />
<ToggleButton hc:ToggleButtonAttach.ShowLabel="True"
Content="Switch"
IsEnabled="False"
IsChecked="True"
HorizontalAlignment="Center"
Margin="5"
Theme="{StaticResource ToggleButtonSwitch}" />
</StackPanel>
<StackPanel VerticalAlignment="Center">
<ToggleButton BorderThickness="0"
IsChecked="True"
Margin="5"
HorizontalAlignment="Center"
Theme="{StaticResource ToggleButtonFlip}">
<hc:StatusSwitchElement.CheckedElement>
<Border Background="{DynamicResource PrimaryBrush}">
<TextBlock HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="Off"
Foreground="{DynamicResource TextIconBrush}" />
</Border>
</hc:StatusSwitchElement.CheckedElement>
<Border Background="{DynamicResource DangerBrush}">
<TextBlock HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="On"
Foreground="{DynamicResource TextIconBrush}" />
</Border>
</ToggleButton>
<ToggleButton BorderThickness="0"
IsEnabled="False"
IsChecked="True"
Margin="5"
HorizontalAlignment="Center"
Theme="{StaticResource ToggleButtonFlip}">
<hc:StatusSwitchElement.CheckedElement>
<Border Background="{DynamicResource PrimaryBrush}">
<TextBlock HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="Off"
Foreground="{DynamicResource TextIconBrush}" />
</Border>
</hc:StatusSwitchElement.CheckedElement>
<Border Background="{DynamicResource DangerBrush}">
<TextBlock HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="On}"
Foreground="{DynamicResource TextIconBrush}" />
</Border>
</ToggleButton>
</StackPanel>
</WrapPanel>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Orientation="Vertical"
Spacing="32">
<WrapPanel>
<StackPanel>
<ToggleButton IsChecked="True"
Content="Default"
Margin="5"
Theme="{StaticResource ToggleButtonDefault.Small}" />
<ToggleButton IsEnabled="False"
IsChecked="True"
Content="Default"
Margin="5"
Theme="{StaticResource ToggleButtonDefault.Small}" />
</StackPanel>
<StackPanel>
<ToggleButton IsChecked="True"
Content="Primary"
Margin="5"
Theme="{StaticResource ToggleButtonPrimary.Small}" />
<ToggleButton IsEnabled="False"
IsChecked="True"
Content="Primary"
Margin="5"
Theme="{StaticResource ToggleButtonPrimary.Small}" />
</StackPanel>
<StackPanel>
<ToggleButton IsChecked="True"
Content="Success"
Margin="5"
Theme="{StaticResource ToggleButtonSuccess.Small}" />
<ToggleButton IsEnabled="False"
IsChecked="True"
Content="Success"
Margin="5"
Theme="{StaticResource ToggleButtonSuccess.Small}" />
</StackPanel>
<StackPanel>
<ToggleButton Content="Info"
Margin="5"
Theme="{StaticResource ToggleButtonInfo.Small}" />
<ToggleButton IsEnabled="False"
Content="Info"
Margin="5"
Theme="{StaticResource ToggleButtonInfo.Small}" />
</StackPanel>
<StackPanel>
<ToggleButton Content="Warning"
Margin="5"
Theme="{StaticResource ToggleButtonWarning.Small}" />
<ToggleButton IsEnabled="False"
Content="Warning"
Margin="5"
Theme="{StaticResource ToggleButtonWarning.Small}" />
</StackPanel>
<StackPanel>
<ToggleButton Content="Danger"
Margin="5"
Theme="{StaticResource ToggleButtonDanger.Small}" />
<ToggleButton IsEnabled="False"
Content="Danger"
Margin="5"
Theme="{StaticResource ToggleButtonDanger.Small}" />
</StackPanel>
</WrapPanel>
<WrapPanel>
<StackPanel>
<ToggleButton IsChecked="True"
Content="Clock"
Margin="5"
hc:IconElement.Geometry="{StaticResource ClockGeometry}"
Theme="{StaticResource ToggleButtonDefault.Small}" />
<ToggleButton IsChecked="True"
Content="Clock"
IsEnabled="False"
Margin="5"
hc:IconElement.Geometry="{StaticResource ClockGeometry}"
Theme="{StaticResource ToggleButtonDefault.Small}" />
</StackPanel>
<StackPanel>
<ToggleButton IsChecked="True"
Content="Calendar"
Margin="5"
Theme="{StaticResource ToggleButtonPrimary.Small}"
hc:IconElement.Geometry="{StaticResource CalendarGeometry}" />
<ToggleButton IsChecked="True"
Content="Calendar"
IsEnabled="False"
Margin="5"
Theme="{StaticResource ToggleButtonPrimary.Small}"
hc:IconElement.Geometry="{StaticResource CalendarGeometry}" />
</StackPanel>
<StackPanel>
<ToggleButton IsChecked="True"
Margin="5"
Theme="{StaticResource ToggleButtonSuccess.Small}"
hc:IconElement.Geometry="{StaticResource RotateLeftGeometry}" />
<ToggleButton IsChecked="True"
IsEnabled="False"
Margin="5"
Theme="{StaticResource ToggleButtonSuccess.Small}"
hc:IconElement.Geometry="{StaticResource RotateLeftGeometry}" />
</StackPanel>
<StackPanel>
<ToggleButton Margin="5"
Theme="{StaticResource ToggleButtonInfo.Small}"
hc:IconElement.Geometry="{StaticResource RotateRightGeometry}" />
<ToggleButton IsEnabled="False"
Margin="5"
Theme="{StaticResource ToggleButtonInfo.Small}"
hc:IconElement.Geometry="{StaticResource RotateRightGeometry}" />
</StackPanel>
<StackPanel>
<ToggleButton Margin="5"
Theme="{StaticResource ToggleButtonWarning.Small}"
hc:IconElement.Geometry="{StaticResource LeftGeometry}" />
<ToggleButton IsEnabled="False"
Margin="5"
Theme="{StaticResource ToggleButtonWarning.Small}"
hc:IconElement.Geometry="{StaticResource LeftGeometry}" />
</StackPanel>
<StackPanel>
<ToggleButton Margin="5"
Theme="{StaticResource ToggleButtonDanger.Small}"
hc:IconElement.Geometry="{StaticResource RightGeometry}" />
<ToggleButton IsEnabled="False"
Margin="5"
Theme="{StaticResource ToggleButtonDanger.Small}"
hc:IconElement.Geometry="{StaticResource RightGeometry}" />
</StackPanel>
</WrapPanel>
<WrapPanel>
<StackPanel>
<ToggleButton IsChecked="True"
Margin="5"
Theme="{StaticResource ToggleButtonIcon.Small}"
hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}"
hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}" />
<ToggleButton IsChecked="True"
IsEnabled="False"
Margin="5"
Theme="{StaticResource ToggleButtonIcon.Small}"
hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}"
hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}" />
</StackPanel>
<StackPanel>
<ToggleButton IsChecked="True"
Margin="5"
Theme="{StaticResource ToggleButtonIconPrimary.Small}"
hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}"
hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}" />
<ToggleButton IsChecked="True"
IsEnabled="False"
Margin="5"
Theme="{StaticResource ToggleButtonIconPrimary.Small}"
hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}"
hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}" />
</StackPanel>
<StackPanel>
<ToggleButton IsChecked="True"
Margin="5"
Theme="{StaticResource ToggleButtonIconSuccess.Small}"
hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}"
hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}" />
<ToggleButton IsChecked="True"
IsEnabled="False"
Margin="5"
Theme="{StaticResource ToggleButtonIconSuccess.Small}"
hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}"
hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}" />
</StackPanel>
<StackPanel>
<ToggleButton Margin="5"
Theme="{StaticResource ToggleButtonIconInfo.Small}"
hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}"
hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}" />
<ToggleButton IsEnabled="False"
Margin="5"
Theme="{StaticResource ToggleButtonIconInfo.Small}"
hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}"
hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}" />
</StackPanel>
<StackPanel>
<ToggleButton Margin="5"
Theme="{StaticResource ToggleButtonIconWarning.Small}"
hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}"
hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}" />
<ToggleButton IsEnabled="False"
Margin="5"
Theme="{StaticResource ToggleButtonIconWarning.Small}"
hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}"
hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}" />
</StackPanel>
<StackPanel>
<ToggleButton Margin="5"
Theme="{StaticResource ToggleButtonIconDanger.Small}"
hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}"
hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}" />
<ToggleButton IsEnabled="False"
Margin="5"
Theme="{StaticResource ToggleButtonIconDanger.Small}"
hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}"
hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}" />
</StackPanel>
</WrapPanel>
<WrapPanel>
<StackPanel>
<ToggleButton Margin="5"
Theme="{StaticResource ToggleButtonIconTransparent.Small}"
hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}"
hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}" />
<ToggleButton IsEnabled="False"
Margin="5"
Theme="{StaticResource ToggleButtonIconTransparent.Small}"
hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}"
hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}" />
</StackPanel>
<StackPanel>
<ToggleButton IsChecked="True"
Margin="5,8"
HorizontalAlignment="Center"
Theme="{StaticResource ToggleButtonSwitch.Small}"
hc:VisualElement.HighlightBrush="{DynamicResource DangerBrush}" />
<ToggleButton IsEnabled="False"
IsChecked="True"
HorizontalAlignment="Center"
Margin="5,4"
Theme="{StaticResource ToggleButtonSwitch.Small}" />
</StackPanel>
<StackPanel>
<ToggleButton hc:ToggleButtonAttach.ShowLabel="True"
Content="Switch"
Margin="5,8"
HorizontalAlignment="Center"
Theme="{StaticResource ToggleButtonSwitch.Small}"
hc:VisualElement.HighlightBrush="{DynamicResource DangerBrush}" />
<ToggleButton hc:ToggleButtonAttach.ShowLabel="True"
Content="Switch"
IsEnabled="False"
IsChecked="True"
HorizontalAlignment="Center"
Margin="5,4"
Theme="{StaticResource ToggleButtonSwitch.Small}" />
</StackPanel>
</WrapPanel>
</hc:UniformSpacingPanel>
</hc:UniformSpacingPanel>
</ScrollViewer>
</UserControl>
@@ -0,0 +1,9 @@
namespace HandyControlDemo.UserControl;
public partial class ToggleButtonDemoCtl : Avalonia.Controls.UserControl
{
public ToggleButtonDemoCtl()
{
InitializeComponent();
}
}
@@ -0,0 +1,35 @@
using Avalonia;
using Avalonia.Media;
namespace HandyControl.Controls;
public class IconSwitchElement
{
public static readonly AttachedProperty<Geometry> GeometryProperty =
AvaloniaProperty.RegisterAttached<IconSwitchElement, AvaloniaObject, Geometry>("Geometry");
public static void SetGeometry(AvaloniaObject element, Geometry value) => element.SetValue(GeometryProperty, value);
public static Geometry GetGeometry(AvaloniaObject element) => element.GetValue(GeometryProperty);
public static readonly AttachedProperty<double> WidthProperty =
AvaloniaProperty.RegisterAttached<IconSwitchElement, AvaloniaObject, double>("Width", defaultValue: double.NaN);
public static void SetWidth(AvaloniaObject element, double value) => element.SetValue(WidthProperty, value);
public static double GetWidth(AvaloniaObject element) => element.GetValue(WidthProperty);
public static readonly AttachedProperty<double> HeightProperty =
AvaloniaProperty.RegisterAttached<IconSwitchElement, AvaloniaObject, double>("Height", defaultValue: double.NaN);
public static void SetHeight(AvaloniaObject element, double value) => element.SetValue(HeightProperty, value);
public static double GetHeight(AvaloniaObject element) => element.GetValue(HeightProperty);
public static readonly AttachedProperty<Geometry> GeometrySelectedProperty =
AvaloniaProperty.RegisterAttached<IconSwitchElement, AvaloniaObject, Geometry>("GeometrySelected");
public static void SetGeometrySelected(AvaloniaObject element, Geometry value) =>
element.SetValue(GeometrySelectedProperty, value);
public static Geometry GetGeometrySelected(AvaloniaObject element) => element.GetValue(GeometrySelectedProperty);
}
@@ -0,0 +1,23 @@
using Avalonia;
namespace HandyControl.Controls;
public class StatusSwitchElement
{
public static readonly AttachedProperty<object> CheckedElementProperty =
AvaloniaProperty.RegisterAttached<StatusSwitchElement, AvaloniaObject, object>("CheckedElement");
public static void SetCheckedElement(AvaloniaObject element, object value) =>
element.SetValue(CheckedElementProperty, value);
public static object GetCheckedElement(AvaloniaObject element) => element.GetValue(CheckedElementProperty);
public static readonly AttachedProperty<object> HideUncheckedElementProperty =
AvaloniaProperty.RegisterAttached<StatusSwitchElement, AvaloniaObject, object>("HideUncheckedElement");
public static void SetHideUncheckedElement(AvaloniaObject element, object value) =>
element.SetValue(HideUncheckedElementProperty, value);
public static object GetHideUncheckedElement(AvaloniaObject element) =>
element.GetValue(HideUncheckedElementProperty);
}
@@ -0,0 +1,13 @@
using Avalonia;
namespace HandyControl.Controls;
public class ToggleButtonAttach
{
public static readonly AttachedProperty<bool> ShowLabelProperty =
AvaloniaProperty.RegisterAttached<ToggleButtonAttach, AvaloniaObject, bool>("ShowLabel", inherits: true);
public static void SetShowLabel(AvaloniaObject element, bool value) => element.SetValue(ShowLabelProperty, value);
public static bool GetShowLabel(AvaloniaObject element) => element.GetValue(ShowLabelProperty);
}
@@ -2,9 +2,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converter="clr-namespace:HandyControl.Tools.Converter">
<converter:Boolean2BooleanReConverter x:Key="Boolean2BooleanReConverter" />
<converter:BorderClipConverter x:Key="BorderClipConverter" />
<converter:BorderCircularConverter x:Key="BorderCircularConverter" />
<converter:BorderCircularClipConverter x:Key="BorderCircularClipConverter" />
<converter:GeometrySpacingConverter x:Key="GeometrySpacingConverter" />
</ResourceDictionary>
@@ -111,4 +111,19 @@
</Setter.Value>
</Setter>
</ControlTheme>
<ControlTheme x:Key="BorderCircularClip"
BasedOn="{StaticResource BorderCircular}"
TargetType="Border">
<Setter Property="Clip">
<Setter.Value>
<MultiBinding Converter="{StaticResource BorderCircularClipConverter}">
<Binding Path="Bounds"
RelativeSource="{RelativeSource Self}" />
<Binding Path="CornerRadius"
RelativeSource="{RelativeSource Self}" />
</MultiBinding>
</Setter.Value>
</Setter>
</ControlTheme>
</ResourceDictionary>
@@ -51,7 +51,7 @@
CornerRadius="8"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
IsVisible="{TemplateBinding IsChecked, Converter={StaticResource Boolean2BooleanReConverter}}" />
IsVisible="{TemplateBinding IsChecked, Converter={x:Static BoolConverters.Not}}" />
<ContentPresenter Grid.Column="1"
Focusable="False"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
@@ -101,174 +101,53 @@
BasedOn="{StaticResource RadioButtonBaseStyle}"
TargetType="RadioButton" />
<ControlTheme x:Key="RadioButtonSameAsButtonBaseStyle"
BasedOn="{StaticResource ButtonBaseStyle}"
TargetType="RadioButton">
<Setter Property="Template">
<ControlTemplate>
<Panel>
<Border Background="{TemplateBinding Background}"
CornerRadius="{TemplateBinding CornerRadius}" />
<Border BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="{TemplateBinding BorderBrush}"
CornerRadius="{TemplateBinding CornerRadius}">
<StackPanel Orientation="Horizontal"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Margin="{TemplateBinding Padding}">
<Path Width="{TemplateBinding hc:IconElement.Width}"
Height="{TemplateBinding hc:IconElement.Height}"
Fill="{TemplateBinding Foreground}"
IsVisible="{Binding Path=(hc:IconElement.Geometry), RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static ObjectConverters.IsNotNull}}"
Stretch="Uniform"
Data="{TemplateBinding hc:IconElement.Geometry}" />
<ContentPresenter RecognizesAccessKey="True"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
IsVisible="{Binding $self.Content, Converter={x:Static ObjectConverters.IsNotNull}}"
Margin="{Binding Path=(hc:IconElement.Geometry), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource GeometrySpacingConverter}, ConverterParameter='6,0,0,0'}" />
</StackPanel>
</Border>
<Border Margin="-1"
IsVisible="{TemplateBinding IsChecked}"
CornerRadius="{TemplateBinding CornerRadius}"
BorderThickness="4"
BorderBrush="{DynamicResource DarkMaskBrush}" />
</Panel>
</ControlTemplate>
</Setter>
</ControlTheme>
<ControlTheme x:Key="RadioButtonSameAsButtonDefault"
BasedOn="{StaticResource RadioButtonSameAsButtonBaseStyle}"
TargetType="RadioButton">
<Setter Property="Background"
Value="{DynamicResource RegionBrush}" />
<Setter Property="Foreground"
Value="{DynamicResource PrimaryTextBrush}" />
<Style Selector="^:pointerover">
<Setter Property="Background"
Value="{DynamicResource SecondaryRegionBrush}" />
</Style>
<Style Selector="^:pressed">
<Setter Property="Background"
Value="{DynamicResource BorderBrush}" />
</Style>
</ControlTheme>
BasedOn="{StaticResource ToggleButtonDefault}"
TargetType="RadioButton" />
<ControlTheme x:Key="RadioButtonSameAsButtonDefault.Small"
BasedOn="{StaticResource RadioButtonSameAsButtonDefault}"
TargetType="RadioButton">
<Setter Property="Height"
Value="20" />
<Setter Property="Padding"
Value="6,1" />
<Setter Property="hc:IconElement.Height"
Value="12" />
</ControlTheme>
BasedOn="{StaticResource ToggleButtonDefault.Small}"
TargetType="RadioButton" />
<ControlTheme x:Key="RadioButtonSameAsButtonPrimary"
BasedOn="{StaticResource RadioButtonSameAsButtonBaseStyle}"
TargetType="RadioButton">
<Setter Property="Background"
Value="{DynamicResource PrimaryBrush}" />
<Setter Property="BorderBrush"
Value="{DynamicResource PrimaryBrush}" />
</ControlTheme>
BasedOn="{StaticResource ToggleButtonPrimary}"
TargetType="RadioButton" />
<ControlTheme x:Key="RadioButtonSameAsButtonPrimary.Small"
BasedOn="{StaticResource RadioButtonSameAsButtonPrimary}"
TargetType="RadioButton">
<Setter Property="Height"
Value="20" />
<Setter Property="Padding"
Value="6,1" />
<Setter Property="hc:IconElement.Height"
Value="12" />
</ControlTheme>
BasedOn="{StaticResource ToggleButtonPrimary.Small}"
TargetType="RadioButton" />
<ControlTheme x:Key="RadioButtonSameAsButtonSuccess"
BasedOn="{StaticResource RadioButtonSameAsButtonBaseStyle}"
TargetType="RadioButton">
<Setter Property="Background"
Value="{DynamicResource SuccessBrush}" />
<Setter Property="BorderBrush"
Value="{DynamicResource SuccessBrush}" />
</ControlTheme>
BasedOn="{StaticResource ToggleButtonSuccess}"
TargetType="RadioButton" />
<ControlTheme x:Key="RadioButtonSameAsButtonSuccess.Small"
BasedOn="{StaticResource RadioButtonSameAsButtonSuccess}"
TargetType="RadioButton">
<Setter Property="Height"
Value="20" />
<Setter Property="Padding"
Value="6,1" />
<Setter Property="hc:IconElement.Height"
Value="12" />
</ControlTheme>
BasedOn="{StaticResource ToggleButtonSuccess.Small}"
TargetType="RadioButton" />
<ControlTheme x:Key="RadioButtonSameAsButtonInfo"
BasedOn="{StaticResource RadioButtonSameAsButtonBaseStyle}"
TargetType="RadioButton">
<Setter Property="Background"
Value="{DynamicResource InfoBrush}" />
<Setter Property="BorderBrush"
Value="{DynamicResource InfoBrush}" />
</ControlTheme>
BasedOn="{StaticResource ToggleButtonInfo}"
TargetType="RadioButton" />
<ControlTheme x:Key="RadioButtonSameAsButtonInfo.Small"
BasedOn="{StaticResource RadioButtonSameAsButtonInfo}"
TargetType="RadioButton">
<Setter Property="Height"
Value="20" />
<Setter Property="Padding"
Value="6,1" />
<Setter Property="hc:IconElement.Height"
Value="12" />
</ControlTheme>
BasedOn="{StaticResource ToggleButtonInfo.Small}"
TargetType="RadioButton" />
<ControlTheme x:Key="RadioButtonSameAsButtonWarning"
BasedOn="{StaticResource RadioButtonSameAsButtonBaseStyle}"
TargetType="RadioButton">
<Setter Property="Background"
Value="{DynamicResource WarningBrush}" />
<Setter Property="BorderBrush"
Value="{DynamicResource WarningBrush}" />
</ControlTheme>
BasedOn="{StaticResource ToggleButtonWarning}"
TargetType="RadioButton" />
<ControlTheme x:Key="RadioButtonSameAsButtonWarning.Small"
BasedOn="{StaticResource RadioButtonSameAsButtonWarning}"
TargetType="RadioButton">
<Setter Property="Height"
Value="20" />
<Setter Property="Padding"
Value="6,1" />
<Setter Property="hc:IconElement.Height"
Value="12" />
</ControlTheme>
BasedOn="{StaticResource ToggleButtonWarning.Small}"
TargetType="RadioButton" />
<ControlTheme x:Key="RadioButtonSameAsButtonDanger"
BasedOn="{StaticResource RadioButtonSameAsButtonBaseStyle}"
TargetType="RadioButton">
<Setter Property="Background"
Value="{DynamicResource DangerBrush}" />
<Setter Property="BorderBrush"
Value="{DynamicResource DangerBrush}" />
</ControlTheme>
BasedOn="{StaticResource ToggleButtonDanger}"
TargetType="RadioButton" />
<ControlTheme x:Key="RadioButtonSameAsButtonDanger.Small"
BasedOn="{StaticResource RadioButtonSameAsButtonDanger}"
TargetType="RadioButton">
<Setter Property="Height"
Value="20" />
<Setter Property="Padding"
Value="6,1" />
<Setter Property="hc:IconElement.Height"
Value="12" />
</ControlTheme>
BasedOn="{StaticResource ToggleButtonDanger.Small}"
TargetType="RadioButton" />
<ControlTheme x:Key="RadioButtonIconBaseStyle"
BasedOn="{StaticResource ButtonBaseStyle}"
@@ -15,6 +15,7 @@
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/Window.axaml" />
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/Button.axaml" />
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/RepeatButton.axaml" />
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/ToggleButton.axaml" />
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/RadioButton.axaml" />
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/Border.axaml" />
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/ItemsControl.axaml" />
@@ -0,0 +1,770 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:hc="clr-namespace:HandyControl.Controls">
<ControlTheme x:Key="ToggleButtonBaseStyle"
BasedOn="{StaticResource ButtonBaseStyle}"
TargetType="ToggleButton">
<Setter Property="Template">
<ControlTemplate>
<Panel>
<Border Background="{TemplateBinding Background}"
CornerRadius="{TemplateBinding CornerRadius}" />
<Border BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="{TemplateBinding BorderBrush}"
CornerRadius="{TemplateBinding CornerRadius}">
<StackPanel Orientation="Horizontal"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Margin="{TemplateBinding Padding}">
<Path Width="{TemplateBinding hc:IconElement.Width}"
Height="{TemplateBinding hc:IconElement.Height}"
Fill="{TemplateBinding Foreground}"
IsVisible="{Binding Path=(hc:IconElement.Geometry), RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static ObjectConverters.IsNotNull}}"
Stretch="Uniform"
Data="{TemplateBinding hc:IconElement.Geometry}" />
<ContentPresenter RecognizesAccessKey="True"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
IsVisible="{Binding $self.Content, Converter={x:Static ObjectConverters.IsNotNull}}"
Margin="{Binding Path=(hc:IconElement.Geometry), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource GeometrySpacingConverter}, ConverterParameter='6,0,0,0'}" />
</StackPanel>
</Border>
<Border Margin="-1"
IsVisible="{TemplateBinding IsChecked}"
CornerRadius="{TemplateBinding CornerRadius}"
BorderThickness="4"
BorderBrush="{DynamicResource DarkMaskBrush}" />
</Panel>
</ControlTemplate>
</Setter>
</ControlTheme>
<ControlTheme x:Key="ToggleButtonDefault"
BasedOn="{StaticResource ToggleButtonBaseStyle}"
TargetType="ToggleButton">
<Setter Property="Background"
Value="{DynamicResource RegionBrush}" />
<Setter Property="Foreground"
Value="{DynamicResource PrimaryTextBrush}" />
<Style Selector="^:pointerover">
<Setter Property="Background"
Value="{DynamicResource SecondaryRegionBrush}" />
</Style>
<Style Selector="^:pressed">
<Setter Property="Background"
Value="{DynamicResource BorderBrush}" />
</Style>
</ControlTheme>
<ControlTheme x:Key="ToggleButtonDefault.Small"
BasedOn="{StaticResource ToggleButtonDefault}"
TargetType="ToggleButton">
<Setter Property="Height"
Value="20" />
<Setter Property="Padding"
Value="6,1" />
<Setter Property="hc:IconElement.Height"
Value="12" />
</ControlTheme>
<ControlTheme x:Key="{x:Type ToggleButton}"
BasedOn="{StaticResource ToggleButtonDefault}"
TargetType="ToggleButton" />
<ControlTheme x:Key="ToggleButtonPrimary"
BasedOn="{StaticResource ToggleButtonBaseStyle}"
TargetType="ToggleButton">
<Setter Property="Background"
Value="{DynamicResource PrimaryBrush}" />
<Setter Property="BorderBrush"
Value="{DynamicResource PrimaryBrush}" />
</ControlTheme>
<ControlTheme x:Key="ToggleButtonPrimary.Small"
BasedOn="{StaticResource ToggleButtonPrimary}"
TargetType="ToggleButton">
<Setter Property="Height"
Value="20" />
<Setter Property="Padding"
Value="6,1" />
<Setter Property="hc:IconElement.Height"
Value="12" />
</ControlTheme>
<ControlTheme x:Key="ToggleButtonSuccess"
BasedOn="{StaticResource ToggleButtonBaseStyle}"
TargetType="ToggleButton">
<Setter Property="Background"
Value="{DynamicResource SuccessBrush}" />
<Setter Property="BorderBrush"
Value="{DynamicResource SuccessBrush}" />
</ControlTheme>
<ControlTheme x:Key="ToggleButtonSuccess.Small"
BasedOn="{StaticResource ToggleButtonSuccess}"
TargetType="ToggleButton">
<Setter Property="Height"
Value="20" />
<Setter Property="Padding"
Value="6,1" />
<Setter Property="hc:IconElement.Height"
Value="12" />
</ControlTheme>
<ControlTheme x:Key="ToggleButtonInfo"
BasedOn="{StaticResource ToggleButtonBaseStyle}"
TargetType="ToggleButton">
<Setter Property="Background"
Value="{DynamicResource InfoBrush}" />
<Setter Property="BorderBrush"
Value="{DynamicResource InfoBrush}" />
</ControlTheme>
<ControlTheme x:Key="ToggleButtonInfo.Small"
BasedOn="{StaticResource ToggleButtonInfo}"
TargetType="ToggleButton">
<Setter Property="Height"
Value="20" />
<Setter Property="Padding"
Value="6,1" />
<Setter Property="hc:IconElement.Height"
Value="12" />
</ControlTheme>
<ControlTheme x:Key="ToggleButtonWarning"
BasedOn="{StaticResource ToggleButtonBaseStyle}"
TargetType="ToggleButton">
<Setter Property="Background"
Value="{DynamicResource WarningBrush}" />
<Setter Property="BorderBrush"
Value="{DynamicResource WarningBrush}" />
</ControlTheme>
<ControlTheme x:Key="ToggleButtonWarning.Small"
BasedOn="{StaticResource ToggleButtonWarning}"
TargetType="ToggleButton">
<Setter Property="Height"
Value="20" />
<Setter Property="Padding"
Value="6,1" />
<Setter Property="hc:IconElement.Height"
Value="12" />
</ControlTheme>
<ControlTheme x:Key="ToggleButtonDanger"
BasedOn="{StaticResource ToggleButtonBaseStyle}"
TargetType="ToggleButton">
<Setter Property="Background"
Value="{DynamicResource DangerBrush}" />
<Setter Property="BorderBrush"
Value="{DynamicResource DangerBrush}" />
</ControlTheme>
<ControlTheme x:Key="ToggleButtonDanger.Small"
BasedOn="{StaticResource ToggleButtonDanger}"
TargetType="ToggleButton">
<Setter Property="Height"
Value="20" />
<Setter Property="Padding"
Value="6,1" />
<Setter Property="hc:IconElement.Height"
Value="12" />
</ControlTheme>
<ControlTheme x:Key="ToggleButtonIconBaseStyle"
TargetType="ToggleButton">
<Setter Property="Foreground"
Value="{DynamicResource TextIconBrush}" />
<Setter Property="Width"
Value="{StaticResource DefaultControlHeight}" />
<Setter Property="Height"
Value="{StaticResource DefaultControlHeight}" />
<Setter Property="Padding"
Value="8" />
<Setter Property="hc:IconSwitchElement.Geometry"
Value="{x:Null}" />
<Setter Property="hc:IconSwitchElement.GeometrySelected"
Value="{x:Null}" />
<Setter Property="hc:BorderElement.CornerRadius"
Value="{StaticResource DefaultCornerRadius}" />
<Setter Property="CornerRadius"
Value="{Binding $self.(hc:BorderElement.CornerRadius)}" />
<Setter Property="BorderBrush"
Value="{DynamicResource BorderBrush}" />
<Setter Property="BorderThickness"
Value="1" />
<Setter Property="HorizontalContentAlignment"
Value="Center" />
<Setter Property="VerticalContentAlignment"
Value="Center" />
<Setter Property="Template">
<ControlTemplate>
<Border BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
CornerRadius="{TemplateBinding CornerRadius}">
<ContentControl HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Margin="{TemplateBinding Padding}">
<Path Fill="{TemplateBinding Foreground}"
Stretch="Uniform"
Width="{TemplateBinding hc:IconElement.Width}"
Height="{TemplateBinding hc:IconElement.Height}" />
</ContentControl>
</Border>
</ControlTemplate>
</Setter>
<Style Selector="^:pointerover">
<Setter Property="Opacity"
Value="0.9" />
</Style>
<Style Selector="^:pressed">
<Setter Property="Opacity"
Value="0.6" />
</Style>
<Style Selector="^:disabled">
<Setter Property="Opacity"
Value="0.4" />
</Style>
<Style Selector="^:checked /template/ Path">
<Setter Property="Data"
Value="{TemplateBinding hc:IconSwitchElement.GeometrySelected}" />
</Style>
<Style Selector="^:unchecked /template/ Path">
<Setter Property="Data"
Value="{TemplateBinding hc:IconSwitchElement.Geometry}" />
</Style>
</ControlTheme>
<ControlTheme x:Key="ToggleButtonIcon"
BasedOn="{StaticResource ToggleButtonIconBaseStyle}"
TargetType="ToggleButton">
<Setter Property="Background"
Value="{DynamicResource RegionBrush}" />
<Setter Property="Foreground"
Value="{DynamicResource PrimaryTextBrush}" />
<Style Selector="^:pointerover">
<Setter Property="Background"
Value="{DynamicResource SecondaryRegionBrush}" />
</Style>
<Style Selector="^:pressed">
<Setter Property="Background"
Value="{DynamicResource BorderBrush}" />
</Style>
</ControlTheme>
<ControlTheme x:Key="ToggleButtonIcon.Small"
BasedOn="{StaticResource ToggleButtonIcon}"
TargetType="ToggleButton">
<Setter Property="Height"
Value="20" />
<Setter Property="Padding"
Value="6,1" />
<Setter Property="hc:IconElement.Height"
Value="12" />
</ControlTheme>
<ControlTheme x:Key="ToggleButtonIconPrimary"
BasedOn="{StaticResource ToggleButtonIconBaseStyle}"
TargetType="ToggleButton">
<Setter Property="Background"
Value="{DynamicResource PrimaryBrush}" />
<Setter Property="BorderBrush"
Value="{DynamicResource PrimaryBrush}" />
</ControlTheme>
<ControlTheme x:Key="ToggleButtonIconPrimary.Small"
BasedOn="{StaticResource ToggleButtonIconPrimary}"
TargetType="ToggleButton">
<Setter Property="Height"
Value="20" />
<Setter Property="Padding"
Value="6,1" />
<Setter Property="hc:IconElement.Height"
Value="12" />
</ControlTheme>
<ControlTheme x:Key="ToggleButtonIconSuccess"
BasedOn="{StaticResource ToggleButtonIconBaseStyle}"
TargetType="ToggleButton">
<Setter Property="Background"
Value="{DynamicResource SuccessBrush}" />
<Setter Property="BorderBrush"
Value="{DynamicResource SuccessBrush}" />
</ControlTheme>
<ControlTheme x:Key="ToggleButtonIconSuccess.Small"
BasedOn="{StaticResource ToggleButtonIconSuccess}"
TargetType="ToggleButton">
<Setter Property="Height"
Value="20" />
<Setter Property="Padding"
Value="6,1" />
<Setter Property="hc:IconElement.Height"
Value="12" />
</ControlTheme>
<ControlTheme x:Key="ToggleButtonIconInfo"
BasedOn="{StaticResource ToggleButtonIconBaseStyle}"
TargetType="ToggleButton">
<Setter Property="Background"
Value="{DynamicResource InfoBrush}" />
<Setter Property="BorderBrush"
Value="{DynamicResource InfoBrush}" />
</ControlTheme>
<ControlTheme x:Key="ToggleButtonIconInfo.Small"
BasedOn="{StaticResource ToggleButtonIconInfo}"
TargetType="ToggleButton">
<Setter Property="Height"
Value="20" />
<Setter Property="Padding"
Value="6,1" />
<Setter Property="hc:IconElement.Height"
Value="12" />
</ControlTheme>
<ControlTheme x:Key="ToggleButtonIconWarning"
BasedOn="{StaticResource ToggleButtonIconBaseStyle}"
TargetType="ToggleButton">
<Setter Property="Background"
Value="{DynamicResource WarningBrush}" />
<Setter Property="BorderBrush"
Value="{DynamicResource WarningBrush}" />
</ControlTheme>
<ControlTheme x:Key="ToggleButtonIconWarning.Small"
BasedOn="{StaticResource ToggleButtonIconWarning}"
TargetType="ToggleButton">
<Setter Property="Height"
Value="20" />
<Setter Property="Padding"
Value="6,1" />
<Setter Property="hc:IconElement.Height"
Value="12" />
</ControlTheme>
<ControlTheme x:Key="ToggleButtonIconDanger"
BasedOn="{StaticResource ToggleButtonIconBaseStyle}"
TargetType="ToggleButton">
<Setter Property="Background"
Value="{DynamicResource DangerBrush}" />
<Setter Property="BorderBrush"
Value="{DynamicResource DangerBrush}" />
</ControlTheme>
<ControlTheme x:Key="ToggleButtonIconDanger.Small"
BasedOn="{StaticResource ToggleButtonIconDanger}"
TargetType="ToggleButton">
<Setter Property="Height"
Value="20" />
<Setter Property="Padding"
Value="6,1" />
<Setter Property="hc:IconElement.Height"
Value="12" />
</ControlTheme>
<ControlTheme x:Key="ToggleButtonIconTransparent"
BasedOn="{StaticResource ToggleButtonIconBaseStyle}"
TargetType="ToggleButton">
<Setter Property="Background"
Value="Transparent" />
<Setter Property="BorderBrush"
Value="Transparent" />
<Setter Property="Foreground"
Value="{DynamicResource PrimaryTextBrush}" />
<Setter Property="Template">
<ControlTemplate>
<Border BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}">
<ContentControl HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Margin="{TemplateBinding Padding}">
<Path Fill="{TemplateBinding Foreground}"
Stretch="Uniform"
Width="{TemplateBinding hc:IconElement.Width}"
Height="{TemplateBinding hc:IconElement.Height}" />
</ContentControl>
</Border>
</ControlTemplate>
</Setter>
</ControlTheme>
<ControlTheme x:Key="ToggleButtonIconTransparent.Small"
BasedOn="{StaticResource ToggleButtonIconTransparent}"
TargetType="ToggleButton">
<Setter Property="Height"
Value="20" />
<Setter Property="Padding"
Value="6,1" />
<Setter Property="hc:IconElement.Height"
Value="12" />
</ControlTheme>
<ControlTheme x:Key="ToggleButtonCustom"
TargetType="ToggleButton">
<Setter Property="Foreground"
Value="{DynamicResource PrimaryTextBrush}" />
<Setter Property="hc:BorderElement.CornerRadius"
Value="0" />
<Setter Property="CornerRadius"
Value="{Binding $self.(hc:BorderElement.CornerRadius)}" />
<Setter Property="Background"
Value="Transparent" />
<Setter Property="HorizontalAlignment"
Value="Center" />
<Setter Property="VerticalAlignment"
Value="Center" />
<Setter Property="HorizontalContentAlignment"
Value="Center" />
<Setter Property="VerticalContentAlignment"
Value="Center" />
<Setter Property="Padding"
Value="0" />
<Setter Property="BorderThickness"
Value="0" />
<Setter Property="Template">
<ControlTemplate>
<Border x:Name="Chrome"
CornerRadius="{TemplateBinding CornerRadius}"
BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="{TemplateBinding BorderBrush}"
Background="{TemplateBinding Background}">
<Panel>
<ContentPresenter Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
RecognizesAccessKey="True"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}">
<ContentPresenter.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="(hc:StatusSwitchElement.HideUncheckedElement)"
RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="IsChecked"
RelativeSource="{RelativeSource TemplatedParent}" />
</MultiBinding>
</ContentPresenter.IsVisible>
</ContentPresenter>
<ContentPresenter Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
RecognizesAccessKey="True"
IsVisible="{TemplateBinding IsChecked}"
Content="{TemplateBinding hc:StatusSwitchElement.CheckedElement}"
ContentTemplate="{TemplateBinding ContentTemplate}" />
</Panel>
</Border>
</ControlTemplate>
</Setter>
<Style Selector="^:pointerover">
<Setter Property="Opacity"
Value="0.9" />
</Style>
<Style Selector="^:pressed">
<Setter Property="Opacity"
Value="0.6" />
</Style>
<Style Selector="^:disabled">
<Setter Property="Opacity"
Value="0.4" />
</Style>
</ControlTheme>
<ControlTheme x:Key="ToggleButtonSwitchBaseStyle"
TargetType="ToggleButton">
<Setter Property="hc:VisualElement.HighlightBrush"
Value="{DynamicResource PrimaryBrush}" />
<Setter Property="hc:VisualElement.HighlightForeground"
Value="{DynamicResource SecondaryBorderBrush}" />
<Setter Property="Background"
Value="{DynamicResource SecondaryRegionBrush}" />
<Setter Property="Foreground"
Value="{DynamicResource PrimaryTextBrush}" />
<Setter Property="BorderBrush"
Value="{DynamicResource BorderBrush}" />
<Setter Property="BorderThickness"
Value="0" />
<Setter Property="VerticalContentAlignment"
Value="Center" />
<Setter Property="Padding"
Value="6,0,0,0" />
<Setter Property="Height"
Value="24" />
<Setter Property="Template">
<ControlTemplate>
<Grid Background="Transparent"
ColumnDefinitions="Auto, *">
<Viewbox>
<Panel Width="80"
Height="48">
<Border BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
CornerRadius="24"
x:Name="innerBorder">
<Ellipse HorizontalAlignment="Right"
IsVisible="{TemplateBinding hc:ToggleButtonAttach.ShowLabel}"
Margin="0 0 12 0"
Width="16"
Height="16"
StrokeThickness="2"
Stroke="{TemplateBinding hc:VisualElement.HighlightForeground}" />
<Border.Transitions>
<Transitions>
<DoubleTransition Property="Opacity"
Duration="0:0:0.2" />
</Transitions>
</Border.Transitions>
</Border>
<Border BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Opacity="0"
Background="{TemplateBinding hc:VisualElement.HighlightBrush}"
CornerRadius="24"
x:Name="lightBorder">
<Rectangle HorizontalAlignment="Left"
IsVisible="{TemplateBinding hc:ToggleButtonAttach.ShowLabel}"
Margin="18 0 0 0"
Width="2"
Height="16"
RadiusX="1"
RadiusY="1"
Fill="{DynamicResource TextIconBrush}" />
<Border.Transitions>
<Transitions>
<DoubleTransition Property="Opacity"
Duration="0:0:0.2" />
</Transitions>
</Border.Transitions>
</Border>
<Border Margin="2"
HorizontalAlignment="Left"
CornerRadius="22"
Effect="{StaticResource EffectShadow2}"
Background="White"
Width="44"
Height="44"
RenderTransform="translateX(0px)"
x:Name="thumb">
<Border.Transitions>
<Transitions>
<TransformOperationsTransition Property="RenderTransform"
Easing="CubicEaseInOut"
Duration="0:0:0.2" />
</Transitions>
</Border.Transitions>
</Border>
</Panel>
</Viewbox>
<ContentPresenter x:Name="contentPresenter"
IsVisible="{Binding $self.Content, Converter={x:Static ObjectConverters.IsNotNull}}"
Grid.Column="1"
Focusable="False"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="{TemplateBinding Padding}"
RecognizesAccessKey="True"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Grid>
</ControlTemplate>
</Setter>
<Style Selector="^:checked /template/ Border#thumb">
<Setter Property="RenderTransform"
Value="translateX(32px)" />
</Style>
<Style Selector="^:unchecked /template/ Border#thumb">
<Setter Property="RenderTransform"
Value="translateX(0px)" />
</Style>
<Style Selector="^:checked /template/ Border#lightBorder">
<Setter Property="Opacity"
Value="1" />
</Style>
<Style Selector="^:unchecked /template/ Border#lightBorder">
<Setter Property="Opacity"
Value="0" />
</Style>
<Style Selector="^:checked /template/ Border#innerBorder">
<Setter Property="Opacity"
Value="0" />
</Style>
<Style Selector="^:unchecked /template/ Border#innerBorder">
<Setter Property="Opacity"
Value="1" />
</Style>
<Style Selector="^:disabled">
<Setter Property="Opacity"
Value="0.4" />
</Style>
</ControlTheme>
<ControlTheme x:Key="ToggleButtonSwitch"
BasedOn="{StaticResource ToggleButtonSwitchBaseStyle}"
TargetType="ToggleButton" />
<ControlTheme x:Key="ToggleButtonSwitch.Small"
BasedOn="{StaticResource ToggleButtonSwitch}"
TargetType="ToggleButton">
<Setter Property="Height"
Value="16" />
</ControlTheme>
<ControlTheme x:Key="ToggleButtonFlip"
TargetType="ToggleButton">
<Setter Property="Foreground"
Value="{DynamicResource PrimaryTextBrush}" />
<Setter Property="Background"
Value="{DynamicResource RegionBrush}" />
<Setter Property="HorizontalAlignment"
Value="Center" />
<Setter Property="VerticalAlignment"
Value="Center" />
<Setter Property="Padding"
Value="0" />
<Setter Property="BorderThickness"
Value="1" />
<Setter Property="Height"
Value="{StaticResource DefaultControlHeight}" />
<Setter Property="Width"
Value="{StaticResource DefaultControlHeight}" />
<Setter Property="Template">
<ControlTemplate>
<Viewbox>
<Panel Height="28"
Width="28">
<Border x:Name="unCheckedElement"
Theme="{StaticResource BorderCircularClip}"
BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="{TemplateBinding BorderBrush}"
Background="{TemplateBinding Background}"
RenderTransform="scaleX(1)">
<Border.Transitions>
<Transitions>
<TransformOperationsTransition Property="RenderTransform"
Easing="CubicEaseOut"
Duration="0:0:0.2" />
<DoubleTransition Property="Opacity"
Easing="CubicEaseOut"
Duration="0:0:0.1" />
</Transitions>
</Border.Transitions>
<ContentPresenter Margin="{TemplateBinding Padding}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
RecognizesAccessKey="True" />
</Border>
<Border x:Name="checkedElement"
Theme="{StaticResource BorderCircularClip}"
BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="{TemplateBinding BorderBrush}"
Background="{TemplateBinding Background}"
RenderTransform="scaleX(0)"
Opacity="0">
<Border.Transitions>
<Transitions>
<TransformOperationsTransition Property="RenderTransform"
Easing="CubicEaseOut"
Duration="0:0:0.2" />
<DoubleTransition Property="Opacity"
Easing="CubicEaseOut"
Duration="0:0:0.1" />
</Transitions>
</Border.Transitions>
<ContentPresenter Margin="{TemplateBinding Padding}"
Content="{TemplateBinding hc:StatusSwitchElement.CheckedElement}"
ContentTemplate="{TemplateBinding ContentTemplate}"
RecognizesAccessKey="True" />
</Border>
</Panel>
</Viewbox>
</ControlTemplate>
</Setter>
<Style Selector="^:checked /template/ Border#unCheckedElement">
<Setter Property="RenderTransform"
Value="scaleX(0)" />
</Style>
<Style Selector="^:checked /template/ Border#checkedElement">
<Setter Property="RenderTransform"
Value="scaleX(1)" />
</Style>
<Style Selector="^:unchecked /template/ Border#unCheckedElement">
<Setter Property="RenderTransform"
Value="scaleX(1)" />
</Style>
<Style Selector="^:unchecked /template/ Border#checkedElement">
<Setter Property="RenderTransform"
Value="scaleX(0)" />
</Style>
<Style Selector="^:checked /template/ Border#unCheckedElement">
<Setter Property="Opacity"
Value="0" />
</Style>
<Style Selector="^:checked /template/ Border#checkedElement">
<Setter Property="Opacity"
Value="1" />
</Style>
<Style Selector="^:unchecked /template/ Border#unCheckedElement">
<Setter Property="Opacity"
Value="1" />
</Style>
<Style Selector="^:unchecked /template/ Border#checkedElement">
<Setter Property="Opacity"
Value="0" />
</Style>
<Style Selector="^:pointerover">
<Setter Property="Opacity"
Value="0.9" />
</Style>
<Style Selector="^:pressed">
<Setter Property="Opacity"
Value="0.6" />
</Style>
<Style Selector="^:disabled">
<Setter Property="Opacity"
Value="0.4" />
</Style>
</ControlTheme>
<ControlTheme x:Key="ToggleButtonFlip.Small"
BasedOn="{StaticResource ToggleButtonFlip}"
TargetType="ToggleButton">
<Setter Property="Height"
Value="20" />
<Setter Property="Width"
Value="20" />
</ControlTheme>
</ResourceDictionary>
@@ -1,28 +0,0 @@
using System;
using System.Globalization;
using Avalonia.Data.Converters;
namespace HandyControl.Tools.Converter;
public class Boolean2BooleanReConverter : IValueConverter
{
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is bool boolValue)
{
return !boolValue;
}
return value;
}
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is bool boolValue)
{
return !boolValue;
}
return value;
}
}
@@ -0,0 +1,30 @@
//referenced from https://stackoverflow.com/a/5650367/9639378
using System;
using System.Collections.Generic;
using System.Globalization;
using Avalonia;
using Avalonia.Data.Converters;
using Avalonia.Media;
namespace HandyControl.Tools.Converter;
public class BorderCircularClipConverter : IMultiValueConverter
{
private static readonly Geometry Empty = new StreamGeometry();
public object Convert(IList<object?> values, Type targetType, object? parameter, CultureInfo culture)
{
if (values is not [Rect rect, CornerRadius radius])
{
return AvaloniaProperty.UnsetValue;
}
if (rect.Width < double.Epsilon || rect.Height < double.Epsilon)
{
return Empty;
}
return new RectangleGeometry(new Rect(0, 0, rect.Width, rect.Height), radius.TopLeft, radius.TopLeft);
}
}
@@ -1798,7 +1798,6 @@
<Path x:Name="PathIcon" Width="{TemplateBinding hc:IconElement.Width}" Height="{TemplateBinding hc:IconElement.Height}" Fill="{TemplateBinding Foreground}" SnapsToDevicePixels="True" Stretch="Uniform" Data="{TemplateBinding hc:IconSwitchElement.Geometry}" />
</ContentControl>
</Border>
<Border Visibility="Collapsed" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" x:Name="BorderChecked" BorderThickness="4" BorderBrush="{TemplateBinding BorderBrush}" />
</hc:SimplePanel>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
@@ -1885,18 +1884,10 @@
<Viewbox>
<hc:SimplePanel Width="80" Height="48">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="24" Name="innerBorder">
<hc:ToggleBlock HorizontalAlignment="Right" Margin="0 0 12 0" IsChecked="{Binding Path=(hc:ToggleButtonAttach.ShowLabel),RelativeSource={RelativeSource TemplatedParent}}">
<hc:ToggleBlock.CheckedContent>
<Ellipse Width="16" Height="16" StrokeThickness="2" Stroke="{Binding Path=(hc:VisualElement.HighlightForeground),RelativeSource={RelativeSource TemplatedParent}}" />
</hc:ToggleBlock.CheckedContent>
</hc:ToggleBlock>
<Ellipse HorizontalAlignment="Right" Visibility="{Binding Path=(hc:ToggleButtonAttach.ShowLabel), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource Boolean2VisibilityConverter}}" Margin="0 0 12 0" Width="16" Height="16" StrokeThickness="2" Stroke="{Binding Path=(hc:VisualElement.HighlightForeground),RelativeSource={RelativeSource TemplatedParent}}" />
</Border>
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Opacity="0" x:Name="lightBorder" Background="{Binding Path=(hc:VisualElement.HighlightBrush),RelativeSource={RelativeSource TemplatedParent}}" CornerRadius="24">
<hc:ToggleBlock HorizontalAlignment="Left" Margin="18 0 0 0" IsChecked="{Binding Path=(hc:ToggleButtonAttach.ShowLabel),RelativeSource={RelativeSource TemplatedParent}}">
<hc:ToggleBlock.CheckedContent>
<Rectangle Width="3" Height="16" RadiusX="1.5" RadiusY="1.5" Fill="{DynamicResource TextIconBrush}" />
</hc:ToggleBlock.CheckedContent>
</hc:ToggleBlock>
<Rectangle HorizontalAlignment="Left" Visibility="{Binding Path=(hc:ToggleButtonAttach.ShowLabel), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource Boolean2VisibilityConverter}}" Margin="18 0 0 0" Width="2" Height="16" RadiusX="1" RadiusY="1" Fill="{DynamicResource TextIconBrush}" />
</Border>
<Border Margin="2" HorizontalAlignment="Left" CornerRadius="22" Name="thumb" Effect="{StaticResource EffectShadow2}" Background="White" Width="44" Height="44" RenderTransformOrigin="0.5,0.5">
<Border.RenderTransform>
@@ -3479,7 +3470,7 @@
<Setter Property="Padding" Value="6,1" />
<Setter Property="hc:IconElement.Height" Value="12" />
</Style>
<Style BasedOn="{StaticResource ToggleButtonDefault}" TargetType="ToggleButton" />
<Style x:Key="{x:Type ToggleButton}" BasedOn="{StaticResource ToggleButtonDefault}" TargetType="ToggleButton" />
<Style x:Key="ToggleButtonPrimary" BasedOn="{StaticResource ToggleButtonBaseStyle}" TargetType="ToggleButton">
<Setter Property="Background" Value="{DynamicResource PrimaryBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}" />
@@ -37,16 +37,16 @@
</WrapPanel>
<WrapPanel>
<StackPanel>
<ToggleButton Content="{ex:Lang Key={x:Static langs:LangKeys.Clock}}" Margin="5" hc:IconElement.Geometry="{StaticResource ClockGeometry}"/>
<ToggleButton Content="{ex:Lang Key={x:Static langs:LangKeys.Clock}}" IsEnabled="False" Margin="5" hc:IconElement.Geometry="{StaticResource ClockGeometry}"/>
<ToggleButton Content="{ex:Lang Key={x:Static langs:LangKeys.Clock}}" IsChecked="True" Margin="5" hc:IconElement.Geometry="{StaticResource ClockGeometry}"/>
<ToggleButton Content="{ex:Lang Key={x:Static langs:LangKeys.Clock}}" IsChecked="True" IsEnabled="False" Margin="5" hc:IconElement.Geometry="{StaticResource ClockGeometry}"/>
</StackPanel>
<StackPanel>
<ToggleButton Content="{ex:Lang Key={x:Static langs:LangKeys.Calendar}}" Margin="5" Style="{StaticResource ToggleButtonPrimary}" hc:IconElement.Geometry="{StaticResource CalendarGeometry}"/>
<ToggleButton Content="{ex:Lang Key={x:Static langs:LangKeys.Calendar}}" IsEnabled="False" Margin="5" Style="{StaticResource ToggleButtonPrimary}" hc:IconElement.Geometry="{StaticResource CalendarGeometry}"/>
<ToggleButton Content="{ex:Lang Key={x:Static langs:LangKeys.Calendar}}" IsChecked="True" Margin="5" Style="{StaticResource ToggleButtonPrimary}" hc:IconElement.Geometry="{StaticResource CalendarGeometry}"/>
<ToggleButton Content="{ex:Lang Key={x:Static langs:LangKeys.Calendar}}" IsChecked="True" IsEnabled="False" Margin="5" Style="{StaticResource ToggleButtonPrimary}" hc:IconElement.Geometry="{StaticResource CalendarGeometry}"/>
</StackPanel>
<StackPanel>
<ToggleButton Margin="5" Style="{StaticResource ToggleButtonSuccess}" hc:IconElement.Geometry="{StaticResource RotateLeftGeometry}"/>
<ToggleButton IsEnabled="False" Margin="5" Style="{StaticResource ToggleButtonSuccess}" hc:IconElement.Geometry="{StaticResource RotateLeftGeometry}"/>
<ToggleButton IsChecked="True" Margin="5" Style="{StaticResource ToggleButtonSuccess}" hc:IconElement.Geometry="{StaticResource RotateLeftGeometry}"/>
<ToggleButton IsChecked="True" IsEnabled="False" Margin="5" Style="{StaticResource ToggleButtonSuccess}" hc:IconElement.Geometry="{StaticResource RotateLeftGeometry}"/>
</StackPanel>
<StackPanel>
<ToggleButton Margin="5" Style="{StaticResource ToggleButtonInfo}" hc:IconElement.Geometry="{StaticResource RotateRightGeometry}"/>
@@ -63,16 +63,16 @@
</WrapPanel>
<WrapPanel>
<StackPanel>
<ToggleButton Margin="5" Style="{StaticResource ToggleButtonIcon}" hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}"/>
<ToggleButton IsEnabled="False" Margin="5" Style="{StaticResource ToggleButtonIcon}" hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}"/>
<ToggleButton IsChecked="True" Margin="5" Style="{StaticResource ToggleButtonIcon}" hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}"/>
<ToggleButton IsChecked="True" IsEnabled="False" Margin="5" Style="{StaticResource ToggleButtonIcon}" hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}"/>
</StackPanel>
<StackPanel>
<ToggleButton Margin="5" Style="{StaticResource ToggleButtonIconPrimary}" hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}"/>
<ToggleButton IsEnabled="False" Margin="5" Style="{StaticResource ToggleButtonIconPrimary}" hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}"/>
<ToggleButton IsChecked="True" Margin="5" Style="{StaticResource ToggleButtonIconPrimary}" hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}"/>
<ToggleButton IsChecked="True" IsEnabled="False" Margin="5" Style="{StaticResource ToggleButtonIconPrimary}" hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}"/>
</StackPanel>
<StackPanel>
<ToggleButton Margin="5" Style="{StaticResource ToggleButtonIconSuccess}" hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}"/>
<ToggleButton IsEnabled="False" Margin="5" Style="{StaticResource ToggleButtonIconSuccess}" hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}"/>
<ToggleButton IsChecked="True" Margin="5" Style="{StaticResource ToggleButtonIconSuccess}" hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}"/>
<ToggleButton IsChecked="True" IsEnabled="False" Margin="5" Style="{StaticResource ToggleButtonIconSuccess}" hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}"/>
</StackPanel>
<StackPanel>
<ToggleButton Margin="5" Style="{StaticResource ToggleButtonIconInfo}" hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}"/>
@@ -114,15 +114,15 @@
</Border>
</ToggleButton>
</StackPanel>
<StackPanel>
<ToggleButton IsChecked="True" Margin="5,9" HorizontalAlignment="Center" Style="{StaticResource ToggleButtonSwitch}" hc:VisualElement.HighlightBrush="{DynamicResource DangerBrush}"/>
<ToggleButton IsEnabled="False" IsChecked="True" HorizontalAlignment="Center" Margin="5,9" Style="{StaticResource ToggleButtonSwitch}"/>
<StackPanel VerticalAlignment="Center">
<ToggleButton IsChecked="True" Margin="5" HorizontalAlignment="Center" Style="{StaticResource ToggleButtonSwitch}" hc:VisualElement.HighlightBrush="{DynamicResource DangerBrush}"/>
<ToggleButton IsEnabled="False" IsChecked="True" HorizontalAlignment="Center" Margin="5" Style="{StaticResource ToggleButtonSwitch}"/>
</StackPanel>
<StackPanel>
<ToggleButton hc:ToggleButtonAttach.ShowLabel="True" Content="Switch" Margin="5,9" HorizontalAlignment="Center" Style="{StaticResource ToggleButtonSwitch}" hc:VisualElement.HighlightBrush="{DynamicResource DangerBrush}" />
<ToggleButton hc:ToggleButtonAttach.ShowLabel="True" Content="Switch" IsEnabled="False" IsChecked="True" HorizontalAlignment="Center" Margin="5,9" Style="{StaticResource ToggleButtonSwitch}" />
<StackPanel VerticalAlignment="Center">
<ToggleButton hc:ToggleButtonAttach.ShowLabel="True" Content="Switch" Margin="5" HorizontalAlignment="Center" Style="{StaticResource ToggleButtonSwitch}" hc:VisualElement.HighlightBrush="{DynamicResource DangerBrush}" />
<ToggleButton hc:ToggleButtonAttach.ShowLabel="True" Content="Switch" IsEnabled="False" IsChecked="True" HorizontalAlignment="Center" Margin="5" Style="{StaticResource ToggleButtonSwitch}" />
</StackPanel>
<StackPanel>
<StackPanel VerticalAlignment="Center">
<ToggleButton BorderThickness="0" IsChecked="True" Margin="5" HorizontalAlignment="Center" Style="{StaticResource ToggleButtonFlip}">
<hc:StatusSwitchElement.CheckedElement>
<Border Background="{DynamicResource PrimaryBrush}">
@@ -175,16 +175,16 @@
</WrapPanel>
<WrapPanel>
<StackPanel>
<ToggleButton Content="{ex:Lang Key={x:Static langs:LangKeys.Clock}}" Margin="5" hc:IconElement.Geometry="{StaticResource ClockGeometry}" Style="{StaticResource ToggleButtonDefault.Small}"/>
<ToggleButton Content="{ex:Lang Key={x:Static langs:LangKeys.Clock}}" IsEnabled="False" Margin="5" hc:IconElement.Geometry="{StaticResource ClockGeometry}" Style="{StaticResource ToggleButtonDefault.Small}"/>
<ToggleButton Content="{ex:Lang Key={x:Static langs:LangKeys.Clock}}" IsChecked="True" Margin="5" hc:IconElement.Geometry="{StaticResource ClockGeometry}" Style="{StaticResource ToggleButtonDefault.Small}"/>
<ToggleButton Content="{ex:Lang Key={x:Static langs:LangKeys.Clock}}" IsChecked="True" IsEnabled="False" Margin="5" hc:IconElement.Geometry="{StaticResource ClockGeometry}" Style="{StaticResource ToggleButtonDefault.Small}"/>
</StackPanel>
<StackPanel>
<ToggleButton Content="{ex:Lang Key={x:Static langs:LangKeys.Calendar}}" Margin="5" Style="{StaticResource ToggleButtonPrimary.Small}" hc:IconElement.Geometry="{StaticResource CalendarGeometry}"/>
<ToggleButton Content="{ex:Lang Key={x:Static langs:LangKeys.Calendar}}" IsEnabled="False" Margin="5" Style="{StaticResource ToggleButtonPrimary.Small}" hc:IconElement.Geometry="{StaticResource CalendarGeometry}"/>
<ToggleButton Content="{ex:Lang Key={x:Static langs:LangKeys.Calendar}}" IsChecked="True" Margin="5" Style="{StaticResource ToggleButtonPrimary.Small}" hc:IconElement.Geometry="{StaticResource CalendarGeometry}"/>
<ToggleButton Content="{ex:Lang Key={x:Static langs:LangKeys.Calendar}}" IsChecked="True" IsEnabled="False" Margin="5" Style="{StaticResource ToggleButtonPrimary.Small}" hc:IconElement.Geometry="{StaticResource CalendarGeometry}"/>
</StackPanel>
<StackPanel>
<ToggleButton Margin="5" Style="{StaticResource ToggleButtonSuccess.Small}" hc:IconElement.Geometry="{StaticResource RotateLeftGeometry}"/>
<ToggleButton IsEnabled="False" Margin="5" Style="{StaticResource ToggleButtonSuccess.Small}" hc:IconElement.Geometry="{StaticResource RotateLeftGeometry}"/>
<ToggleButton IsChecked="True" Margin="5" Style="{StaticResource ToggleButtonSuccess.Small}" hc:IconElement.Geometry="{StaticResource RotateLeftGeometry}"/>
<ToggleButton IsChecked="True" IsEnabled="False" Margin="5" Style="{StaticResource ToggleButtonSuccess.Small}" hc:IconElement.Geometry="{StaticResource RotateLeftGeometry}"/>
</StackPanel>
<StackPanel>
<ToggleButton Margin="5" Style="{StaticResource ToggleButtonInfo.Small}" hc:IconElement.Geometry="{StaticResource RotateRightGeometry}"/>
@@ -201,16 +201,16 @@
</WrapPanel>
<WrapPanel>
<StackPanel>
<ToggleButton Margin="5" Style="{StaticResource ToggleButtonIcon.Small}" hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}"/>
<ToggleButton IsEnabled="False" Margin="5" Style="{StaticResource ToggleButtonIcon.Small}" hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}"/>
<ToggleButton IsChecked="True" Margin="5" Style="{StaticResource ToggleButtonIcon.Small}" hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}"/>
<ToggleButton IsChecked="True" IsEnabled="False" Margin="5" Style="{StaticResource ToggleButtonIcon.Small}" hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}"/>
</StackPanel>
<StackPanel>
<ToggleButton Margin="5" Style="{StaticResource ToggleButtonIconPrimary.Small}" hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}"/>
<ToggleButton IsEnabled="False" Margin="5" Style="{StaticResource ToggleButtonIconPrimary.Small}" hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}"/>
<ToggleButton IsChecked="True" Margin="5" Style="{StaticResource ToggleButtonIconPrimary.Small}" hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}"/>
<ToggleButton IsChecked="True" IsEnabled="False" Margin="5" Style="{StaticResource ToggleButtonIconPrimary.Small}" hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}"/>
</StackPanel>
<StackPanel>
<ToggleButton Margin="5" Style="{StaticResource ToggleButtonIconSuccess.Small}" hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}"/>
<ToggleButton IsEnabled="False" Margin="5" Style="{StaticResource ToggleButtonIconSuccess.Small}" hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}"/>
<ToggleButton IsChecked="True" Margin="5" Style="{StaticResource ToggleButtonIconSuccess.Small}" hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}"/>
<ToggleButton IsChecked="True" IsEnabled="False" Margin="5" Style="{StaticResource ToggleButtonIconSuccess.Small}" hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}"/>
</StackPanel>
<StackPanel>
<ToggleButton Margin="5" Style="{StaticResource ToggleButtonIconInfo.Small}" hc:IconSwitchElement.Geometry="{StaticResource LeftGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource RightGeometry}"/>
@@ -67,7 +67,6 @@
<Path x:Name="PathIcon" Width="{TemplateBinding hc:IconElement.Width}" Height="{TemplateBinding hc:IconElement.Height}" Fill="{TemplateBinding Foreground}" SnapsToDevicePixels="True" Stretch="Uniform" Data="{TemplateBinding hc:IconSwitchElement.Geometry}"/>
</ContentControl>
</Border>
<Border Visibility="Collapsed" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" x:Name="BorderChecked" BorderThickness="4" BorderBrush="{TemplateBinding BorderBrush}"/>
</hc:SimplePanel>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
@@ -155,18 +154,10 @@
<Viewbox>
<hc:SimplePanel Width="80" Height="48">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="24" Name="innerBorder">
<hc:ToggleBlock HorizontalAlignment="Right" Margin="0 0 12 0" IsChecked="{Binding Path=(hc:ToggleButtonAttach.ShowLabel),RelativeSource={RelativeSource TemplatedParent}}">
<hc:ToggleBlock.CheckedContent>
<Ellipse Width="16" Height="16" StrokeThickness="2" Stroke="{Binding Path=(hc:VisualElement.HighlightForeground),RelativeSource={RelativeSource TemplatedParent}}" />
</hc:ToggleBlock.CheckedContent>
</hc:ToggleBlock>
<Ellipse HorizontalAlignment="Right" Visibility="{Binding Path=(hc:ToggleButtonAttach.ShowLabel), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource Boolean2VisibilityConverter}}" Margin="0 0 12 0" Width="16" Height="16" StrokeThickness="2" Stroke="{Binding Path=(hc:VisualElement.HighlightForeground),RelativeSource={RelativeSource TemplatedParent}}" />
</Border>
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Opacity="0" x:Name="lightBorder" Background="{Binding Path=(hc:VisualElement.HighlightBrush),RelativeSource={RelativeSource TemplatedParent}}" CornerRadius="24">
<hc:ToggleBlock HorizontalAlignment="Left" Margin="18 0 0 0" IsChecked="{Binding Path=(hc:ToggleButtonAttach.ShowLabel),RelativeSource={RelativeSource TemplatedParent}}">
<hc:ToggleBlock.CheckedContent>
<Rectangle Width="3" Height="16" RadiusX="1.5" RadiusY="1.5" Fill="{DynamicResource TextIconBrush}" />
</hc:ToggleBlock.CheckedContent>
</hc:ToggleBlock>
<Rectangle HorizontalAlignment="Left" Visibility="{Binding Path=(hc:ToggleButtonAttach.ShowLabel), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource Boolean2VisibilityConverter}}" Margin="18 0 0 0" Width="2" Height="16" RadiusX="1" RadiusY="1" Fill="{DynamicResource TextIconBrush}" />
</Border>
<Border Margin="2" HorizontalAlignment="Left" CornerRadius="22" Name="thumb" Effect="{StaticResource EffectShadow2}" Background="White" Width="44" Height="44" RenderTransformOrigin="0.5,0.5">
<Border.RenderTransform>
@@ -22,7 +22,7 @@
<Setter Property="hc:IconElement.Height" Value="12"/>
</Style>
<Style BasedOn="{StaticResource ToggleButtonDefault}" TargetType="ToggleButton"/>
<Style x:Key="{x:Type ToggleButton}" BasedOn="{StaticResource ToggleButtonDefault}" TargetType="ToggleButton"/>
<Style x:Key="ToggleButtonPrimary" BasedOn="{StaticResource ToggleButtonBaseStyle}" TargetType="ToggleButton">
<Setter Property="Background" Value="{DynamicResource PrimaryBrush}"/>
@@ -1798,7 +1798,6 @@
<Path x:Name="PathIcon" Width="{TemplateBinding hc:IconElement.Width}" Height="{TemplateBinding hc:IconElement.Height}" Fill="{TemplateBinding Foreground}" SnapsToDevicePixels="True" Stretch="Uniform" Data="{TemplateBinding hc:IconSwitchElement.Geometry}" />
</ContentControl>
</Border>
<Border Visibility="Collapsed" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" x:Name="BorderChecked" BorderThickness="4" BorderBrush="{TemplateBinding BorderBrush}" />
</hc:SimplePanel>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
@@ -1885,18 +1884,10 @@
<Viewbox>
<hc:SimplePanel Width="80" Height="48">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="24" Name="innerBorder">
<hc:ToggleBlock HorizontalAlignment="Right" Margin="0 0 12 0" IsChecked="{Binding Path=(hc:ToggleButtonAttach.ShowLabel),RelativeSource={RelativeSource TemplatedParent}}">
<hc:ToggleBlock.CheckedContent>
<Ellipse Width="16" Height="16" StrokeThickness="2" Stroke="{Binding Path=(hc:VisualElement.HighlightForeground),RelativeSource={RelativeSource TemplatedParent}}" />
</hc:ToggleBlock.CheckedContent>
</hc:ToggleBlock>
<Ellipse HorizontalAlignment="Right" Visibility="{Binding Path=(hc:ToggleButtonAttach.ShowLabel), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource Boolean2VisibilityConverter}}" Margin="0 0 12 0" Width="16" Height="16" StrokeThickness="2" Stroke="{Binding Path=(hc:VisualElement.HighlightForeground),RelativeSource={RelativeSource TemplatedParent}}" />
</Border>
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Opacity="0" x:Name="lightBorder" Background="{Binding Path=(hc:VisualElement.HighlightBrush),RelativeSource={RelativeSource TemplatedParent}}" CornerRadius="24">
<hc:ToggleBlock HorizontalAlignment="Left" Margin="18 0 0 0" IsChecked="{Binding Path=(hc:ToggleButtonAttach.ShowLabel),RelativeSource={RelativeSource TemplatedParent}}">
<hc:ToggleBlock.CheckedContent>
<Rectangle Width="3" Height="16" RadiusX="1.5" RadiusY="1.5" Fill="{DynamicResource TextIconBrush}" />
</hc:ToggleBlock.CheckedContent>
</hc:ToggleBlock>
<Rectangle HorizontalAlignment="Left" Visibility="{Binding Path=(hc:ToggleButtonAttach.ShowLabel), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource Boolean2VisibilityConverter}}" Margin="18 0 0 0" Width="3" Height="16" RadiusX="1.5" RadiusY="1.5" Fill="{DynamicResource TextIconBrush}" />
</Border>
<Border Margin="2" HorizontalAlignment="Left" CornerRadius="22" Name="thumb" Effect="{StaticResource EffectShadow2}" Background="White" Width="44" Height="44" RenderTransformOrigin="0.5,0.5">
<Border.RenderTransform>
@@ -3479,7 +3470,7 @@
<Setter Property="Padding" Value="6,1" />
<Setter Property="hc:IconElement.Height" Value="12" />
</Style>
<Style BasedOn="{StaticResource ToggleButtonDefault}" TargetType="ToggleButton" />
<Style x:Key="{x:Type ToggleButton}" BasedOn="{StaticResource ToggleButtonDefault}" TargetType="ToggleButton" />
<Style x:Key="ToggleButtonPrimary" BasedOn="{StaticResource ToggleButtonBaseStyle}" TargetType="ToggleButton">
<Setter Property="Background" Value="{DynamicResource PrimaryBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}" />