chore: add avalonia RadioButton demo.
This commit is contained in:
1 parent
2f0b39773e
commit
4713903b54
13 files changed
+792
-21
No files matched your search
@@ -0,0 +1,344 @@
|
|||||||
|
<UserControl xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
x:Class="HandyControlDemo.UserControl.RadioButtonDemoCtl"
|
||||||
|
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>
|
||||||
|
<RadioButton GroupName="Demo1"
|
||||||
|
IsChecked="True"
|
||||||
|
Content="Default"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonDefault}" />
|
||||||
|
<RadioButton GroupName="Demo1"
|
||||||
|
IsEnabled="False"
|
||||||
|
Content="Default"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonDefault}" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<RadioButton GroupName="Demo1"
|
||||||
|
Content="Primary"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonPrimary}" />
|
||||||
|
<RadioButton GroupName="Demo1"
|
||||||
|
IsEnabled="False"
|
||||||
|
Content="Primary"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonPrimary}" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<RadioButton GroupName="Demo1"
|
||||||
|
Content="Success"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonSuccess}" />
|
||||||
|
<RadioButton GroupName="Demo1"
|
||||||
|
IsEnabled="False"
|
||||||
|
Content="Success"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonSuccess}" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<RadioButton GroupName="Demo1"
|
||||||
|
Content="Info"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonInfo}" />
|
||||||
|
<RadioButton GroupName="Demo1"
|
||||||
|
IsEnabled="False"
|
||||||
|
Content="Info"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonInfo}" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<RadioButton GroupName="Demo1"
|
||||||
|
Content="Warning"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonWarning}" />
|
||||||
|
<RadioButton GroupName="Demo1"
|
||||||
|
IsEnabled="False"
|
||||||
|
Content="Warning"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonWarning}" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<RadioButton GroupName="Demo1"
|
||||||
|
Content="Danger"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonDanger}" />
|
||||||
|
<RadioButton GroupName="Demo1"
|
||||||
|
IsEnabled="False"
|
||||||
|
Content="Danger"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonDanger}" />
|
||||||
|
</StackPanel>
|
||||||
|
</WrapPanel>
|
||||||
|
<WrapPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<RadioButton GroupName="Demo2"
|
||||||
|
IsChecked="True"
|
||||||
|
Content="Clock"
|
||||||
|
Margin="5"
|
||||||
|
hc:IconElement.Geometry="{StaticResource ClockGeometry}"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonDefault}" />
|
||||||
|
<RadioButton GroupName="Demo2"
|
||||||
|
Content="Clock"
|
||||||
|
IsEnabled="False"
|
||||||
|
Margin="5"
|
||||||
|
hc:IconElement.Geometry="{StaticResource ClockGeometry}"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonDefault}" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<RadioButton GroupName="Demo2"
|
||||||
|
Content="Calendar"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonPrimary}"
|
||||||
|
hc:IconElement.Geometry="{StaticResource CalendarGeometry}" />
|
||||||
|
<RadioButton GroupName="Demo2"
|
||||||
|
Content="Calendar"
|
||||||
|
IsEnabled="False"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonPrimary}"
|
||||||
|
hc:IconElement.Geometry="{StaticResource CalendarGeometry}" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<RadioButton GroupName="Demo2"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonSuccess}"
|
||||||
|
hc:IconElement.Geometry="{StaticResource RotateLeftGeometry}" />
|
||||||
|
<RadioButton GroupName="Demo2"
|
||||||
|
IsEnabled="False"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonSuccess}"
|
||||||
|
hc:IconElement.Geometry="{StaticResource RotateLeftGeometry}" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<RadioButton GroupName="Demo2"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonInfo}"
|
||||||
|
hc:IconElement.Geometry="{StaticResource RotateRightGeometry}" />
|
||||||
|
<RadioButton GroupName="Demo2"
|
||||||
|
IsEnabled="False"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonInfo}"
|
||||||
|
hc:IconElement.Geometry="{StaticResource RotateRightGeometry}" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<RadioButton GroupName="Demo2"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonWarning}"
|
||||||
|
hc:IconElement.Geometry="{StaticResource LeftGeometry}" />
|
||||||
|
<RadioButton GroupName="Demo2"
|
||||||
|
IsEnabled="False"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonWarning}"
|
||||||
|
hc:IconElement.Geometry="{StaticResource LeftGeometry}" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<RadioButton GroupName="Demo2"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonDanger}"
|
||||||
|
hc:IconElement.Geometry="{StaticResource RightGeometry}" />
|
||||||
|
<RadioButton GroupName="Demo2"
|
||||||
|
IsEnabled="False"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonDanger}"
|
||||||
|
hc:IconElement.Geometry="{StaticResource RightGeometry}" />
|
||||||
|
</StackPanel>
|
||||||
|
</WrapPanel>
|
||||||
|
<WrapPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<RadioButton GroupName="Demo3"
|
||||||
|
IsChecked="True"
|
||||||
|
Content="Default"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonDefault.Small}" />
|
||||||
|
<RadioButton GroupName="Demo3"
|
||||||
|
IsEnabled="False"
|
||||||
|
Content="Default"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonDefault.Small}" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<RadioButton GroupName="Demo3"
|
||||||
|
Content="Primary"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonPrimary.Small}" />
|
||||||
|
<RadioButton GroupName="Demo3"
|
||||||
|
IsEnabled="False"
|
||||||
|
Content="Primary"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonPrimary.Small}" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<RadioButton GroupName="Demo3"
|
||||||
|
Content="Success"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonSuccess.Small}" />
|
||||||
|
<RadioButton GroupName="Demo3"
|
||||||
|
IsEnabled="False"
|
||||||
|
Content="Success"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonSuccess.Small}" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<RadioButton GroupName="Demo3"
|
||||||
|
Content="Info"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonInfo.Small}" />
|
||||||
|
<RadioButton GroupName="Demo3"
|
||||||
|
IsEnabled="False"
|
||||||
|
Content="Info"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonInfo.Small}" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<RadioButton GroupName="Demo3"
|
||||||
|
Content="Warning"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonWarning.Small}" />
|
||||||
|
<RadioButton GroupName="Demo3"
|
||||||
|
IsEnabled="False"
|
||||||
|
Content="Warning"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonWarning.Small}" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<RadioButton GroupName="Demo3"
|
||||||
|
Content="Danger"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonDanger.Small}" />
|
||||||
|
<RadioButton GroupName="Demo3"
|
||||||
|
IsEnabled="False"
|
||||||
|
Content="Danger"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonDanger.Small}" />
|
||||||
|
</StackPanel>
|
||||||
|
</WrapPanel>
|
||||||
|
<WrapPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<RadioButton GroupName="Demo4"
|
||||||
|
IsChecked="True"
|
||||||
|
Content="Clock"
|
||||||
|
Margin="5"
|
||||||
|
hc:IconElement.Geometry="{StaticResource ClockGeometry}"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonDefault.Small}" />
|
||||||
|
<RadioButton GroupName="Demo4"
|
||||||
|
Content="Clock"
|
||||||
|
IsEnabled="False"
|
||||||
|
Margin="5"
|
||||||
|
hc:IconElement.Geometry="{StaticResource ClockGeometry}"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonDefault.Small}" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<RadioButton GroupName="Demo4"
|
||||||
|
Content="Calendar"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonPrimary.Small}"
|
||||||
|
hc:IconElement.Geometry="{StaticResource CalendarGeometry}" />
|
||||||
|
<RadioButton GroupName="Demo4"
|
||||||
|
Content="Calendar"
|
||||||
|
IsEnabled="False"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonPrimary.Small}"
|
||||||
|
hc:IconElement.Geometry="{StaticResource CalendarGeometry}" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<RadioButton GroupName="Demo4"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonSuccess.Small}"
|
||||||
|
hc:IconElement.Geometry="{StaticResource RotateLeftGeometry}" />
|
||||||
|
<RadioButton GroupName="Demo4"
|
||||||
|
IsEnabled="False"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonSuccess.Small}"
|
||||||
|
hc:IconElement.Geometry="{StaticResource RotateLeftGeometry}" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<RadioButton GroupName="Demo4"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonInfo.Small}"
|
||||||
|
hc:IconElement.Geometry="{StaticResource RotateRightGeometry}" />
|
||||||
|
<RadioButton GroupName="Demo4"
|
||||||
|
IsEnabled="False"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonInfo.Small}"
|
||||||
|
hc:IconElement.Geometry="{StaticResource RotateRightGeometry}" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<RadioButton GroupName="Demo4"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonWarning.Small}"
|
||||||
|
hc:IconElement.Geometry="{StaticResource LeftGeometry}" />
|
||||||
|
<RadioButton GroupName="Demo4"
|
||||||
|
IsEnabled="False"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonWarning.Small}"
|
||||||
|
hc:IconElement.Geometry="{StaticResource LeftGeometry}" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<RadioButton GroupName="Demo4"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonDanger.Small}"
|
||||||
|
hc:IconElement.Geometry="{StaticResource RightGeometry}" />
|
||||||
|
<RadioButton GroupName="Demo4"
|
||||||
|
IsEnabled="False"
|
||||||
|
Margin="5"
|
||||||
|
Theme="{StaticResource RadioButtonSameAsButtonDanger.Small}"
|
||||||
|
hc:IconElement.Geometry="{StaticResource RightGeometry}" />
|
||||||
|
</StackPanel>
|
||||||
|
</WrapPanel>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
<hc:UniformSpacingPanel Orientation="Vertical"
|
||||||
|
Spacing="32">
|
||||||
|
<hc:UniformSpacingPanel Spacing="10"
|
||||||
|
Orientation="Vertical">
|
||||||
|
<RadioButton IsChecked="True"
|
||||||
|
Content="RadioButton" />
|
||||||
|
<RadioButton Content="RadioButton"
|
||||||
|
IsEnabled="False" />
|
||||||
|
<RadioButton Content="RadioButton" />
|
||||||
|
<RadioButton Content="RadioButton"
|
||||||
|
IsEnabled="False" />
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
<hc:UniformSpacingPanel Spacing="10"
|
||||||
|
Orientation="Vertical">
|
||||||
|
<RadioButton Background="{DynamicResource SecondaryRegionBrush}"
|
||||||
|
hc:IconElement.Geometry="{StaticResource CalendarGeometry}"
|
||||||
|
Theme="{StaticResource RadioButtonIcon}"
|
||||||
|
Content="RadioButton" />
|
||||||
|
<RadioButton Background="{DynamicResource SecondaryRegionBrush}"
|
||||||
|
Theme="{StaticResource RadioButtonIcon}"
|
||||||
|
Content="RadioButton"
|
||||||
|
IsChecked="True" />
|
||||||
|
<RadioButton hc:IconElement.Geometry="{StaticResource CalendarGeometry}"
|
||||||
|
Theme="{StaticResource RadioButtonIcon}"
|
||||||
|
Content="RadioButton" />
|
||||||
|
<RadioButton Theme="{StaticResource RadioButtonIcon}"
|
||||||
|
Content="RadioButton" />
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
<hc:UniformSpacingPanel Spacing="10"
|
||||||
|
Orientation="Vertical">
|
||||||
|
<RadioButton Background="{DynamicResource SecondaryRegionBrush}"
|
||||||
|
hc:IconElement.Geometry="{StaticResource CalendarGeometry}"
|
||||||
|
Theme="{StaticResource RadioButtonIcon.Small}"
|
||||||
|
Content="RadioButton" />
|
||||||
|
<RadioButton Background="{DynamicResource SecondaryRegionBrush}"
|
||||||
|
Theme="{StaticResource RadioButtonIcon.Small}"
|
||||||
|
Content="RadioButton"
|
||||||
|
IsChecked="True" />
|
||||||
|
<RadioButton hc:IconElement.Geometry="{StaticResource CalendarGeometry}"
|
||||||
|
Theme="{StaticResource RadioButtonIcon.Small}"
|
||||||
|
Content="RadioButton" />
|
||||||
|
<RadioButton Theme="{StaticResource RadioButtonIcon.Small}"
|
||||||
|
Content="RadioButton" />
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
</ScrollViewer>
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace HandyControlDemo.UserControl;
|
||||||
|
|
||||||
|
public partial class RadioButtonDemoCtl : Avalonia.Controls.UserControl
|
||||||
|
{
|
||||||
|
public RadioButtonDemoCtl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Media;
|
||||||
|
|
||||||
|
namespace HandyControl.Controls;
|
||||||
|
|
||||||
|
public class VisualElement
|
||||||
|
{
|
||||||
|
public static readonly AttachedProperty<IBrush> HighlightBrushProperty =
|
||||||
|
AvaloniaProperty.RegisterAttached<VisualElement, AvaloniaObject, IBrush>("HighlightBrush", inherits: true);
|
||||||
|
|
||||||
|
public static void SetHighlightBrush(AvaloniaObject element, IBrush value) =>
|
||||||
|
element.SetValue(HighlightBrushProperty, value);
|
||||||
|
|
||||||
|
public static IBrush GetHighlightBrush(AvaloniaObject element) => element.GetValue(HighlightBrushProperty);
|
||||||
|
|
||||||
|
public static readonly AttachedProperty<IBrush> HighlightBackgroundProperty =
|
||||||
|
AvaloniaProperty.RegisterAttached<VisualElement, AvaloniaObject, IBrush>("HighlightBackground", inherits: true);
|
||||||
|
|
||||||
|
public static void SetHighlightBackground(AvaloniaObject element, IBrush value) =>
|
||||||
|
element.SetValue(HighlightBackgroundProperty, value);
|
||||||
|
|
||||||
|
public static IBrush GetHighlightBackground(AvaloniaObject element) =>
|
||||||
|
element.GetValue(HighlightBackgroundProperty);
|
||||||
|
|
||||||
|
public static readonly AttachedProperty<IBrush> HighlightBorderBrushProperty =
|
||||||
|
AvaloniaProperty.RegisterAttached<VisualElement, AvaloniaObject, IBrush>("HighlightBorderBrush",
|
||||||
|
inherits: true);
|
||||||
|
|
||||||
|
public static void SetHighlightBorderBrush(AvaloniaObject element, IBrush value) =>
|
||||||
|
element.SetValue(HighlightBorderBrushProperty, value);
|
||||||
|
|
||||||
|
public static IBrush GetHighlightBorderBrush(AvaloniaObject element) =>
|
||||||
|
element.GetValue(HighlightBorderBrushProperty);
|
||||||
|
|
||||||
|
public static readonly AttachedProperty<IBrush> HighlightForegroundProperty =
|
||||||
|
AvaloniaProperty.RegisterAttached<VisualElement, AvaloniaObject, IBrush>("HighlightForeground", inherits: true);
|
||||||
|
|
||||||
|
public static void SetHighlightForeground(AvaloniaObject element, IBrush value) =>
|
||||||
|
element.SetValue(HighlightForegroundProperty, value);
|
||||||
|
|
||||||
|
public static IBrush GetHighlightForeground(AvaloniaObject element) =>
|
||||||
|
element.GetValue(HighlightForegroundProperty);
|
||||||
|
|
||||||
|
public static readonly AttachedProperty<string> TextProperty =
|
||||||
|
AvaloniaProperty.RegisterAttached<VisualElement, AvaloniaObject, string>("Text");
|
||||||
|
|
||||||
|
public static void SetText(AvaloniaObject element, string value) => element.SetValue(TextProperty, value);
|
||||||
|
|
||||||
|
public static string GetText(AvaloniaObject element) => element.GetValue(TextProperty);
|
||||||
|
}
|
||||||
@@ -2,8 +2,9 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:converter="clr-namespace:HandyControl.Tools.Converter">
|
xmlns:converter="clr-namespace:HandyControl.Tools.Converter">
|
||||||
|
|
||||||
|
<converter:Boolean2BooleanReConverter x:Key="Boolean2BooleanReConverter" />
|
||||||
<converter:BorderClipConverter x:Key="BorderClipConverter" />
|
<converter:BorderClipConverter x:Key="BorderClipConverter" />
|
||||||
<converter:BorderCircularConverter x:Key="BorderCircularConverter"/>
|
<converter:BorderCircularConverter x:Key="BorderCircularConverter" />
|
||||||
<converter:GeometrySpacingConverter x:Key="GeometrySpacingConverter" />
|
<converter:GeometrySpacingConverter x:Key="GeometrySpacingConverter" />
|
||||||
|
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
Value="{Binding $self.(hc:BorderElement.CornerRadius)}" />
|
Value="{Binding $self.(hc:BorderElement.CornerRadius)}" />
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate>
|
<ControlTemplate>
|
||||||
<Grid>
|
<Panel>
|
||||||
<Border Background="{TemplateBinding Background}"
|
<Border Background="{TemplateBinding Background}"
|
||||||
CornerRadius="{TemplateBinding CornerRadius}" />
|
CornerRadius="{TemplateBinding CornerRadius}" />
|
||||||
<Border BorderThickness="{TemplateBinding BorderThickness}"
|
<Border BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
Margin="{Binding Path=(hc:IconElement.Geometry), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource GeometrySpacingConverter}, ConverterParameter='6,0,0,0'}" />
|
Margin="{Binding Path=(hc:IconElement.Geometry), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource GeometrySpacingConverter}, ConverterParameter='6,0,0,0'}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
</Grid>
|
</Panel>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,334 @@
|
|||||||
|
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:hc="clr-namespace:HandyControl.Controls">
|
||||||
|
<ControlTheme x:Key="RadioButtonBaseStyle"
|
||||||
|
TargetType="RadioButton">
|
||||||
|
<Setter Property="HorizontalAlignment"
|
||||||
|
Value="Center" />
|
||||||
|
<Setter Property="VerticalAlignment"
|
||||||
|
Value="Center" />
|
||||||
|
<Setter Property="VerticalContentAlignment"
|
||||||
|
Value="Center" />
|
||||||
|
<Setter Property="Background"
|
||||||
|
Value="{DynamicResource RegionBrush}" />
|
||||||
|
<Setter Property="Foreground"
|
||||||
|
Value="{DynamicResource PrimaryTextBrush}" />
|
||||||
|
<Setter Property="BorderBrush"
|
||||||
|
Value="{DynamicResource BorderBrush}" />
|
||||||
|
<Setter Property="BorderThickness"
|
||||||
|
Value="1" />
|
||||||
|
<Setter Property="Padding"
|
||||||
|
Value="6,0,0,0" />
|
||||||
|
<Setter Property="Template">
|
||||||
|
<ControlTemplate>
|
||||||
|
<Grid ColumnDefinitions="Auto, *"
|
||||||
|
Background="Transparent">
|
||||||
|
<Border Height="16"
|
||||||
|
Width="16"
|
||||||
|
Background="{TemplateBinding Background}"
|
||||||
|
CornerRadius="8"
|
||||||
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
|
||||||
|
<Ellipse HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Fill="White"
|
||||||
|
Width="8"
|
||||||
|
Height="8"
|
||||||
|
RenderTransform="scale(0)">
|
||||||
|
<Ellipse.Transitions>
|
||||||
|
<Transitions>
|
||||||
|
<TransformOperationsTransition Property="RenderTransform"
|
||||||
|
Duration="0:0:0.1" />
|
||||||
|
</Transitions>
|
||||||
|
</Ellipse.Transitions>
|
||||||
|
</Ellipse>
|
||||||
|
</Border>
|
||||||
|
<Border Grid.Column="0"
|
||||||
|
Height="16"
|
||||||
|
Width="16"
|
||||||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
|
CornerRadius="8"
|
||||||
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
|
IsVisible="{TemplateBinding IsChecked, Converter={StaticResource Boolean2BooleanReConverter}}" />
|
||||||
|
<ContentPresenter Grid.Column="1"
|
||||||
|
Focusable="False"
|
||||||
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
|
Margin="{TemplateBinding Padding}"
|
||||||
|
RecognizesAccessKey="True"
|
||||||
|
Content="{TemplateBinding Content}"
|
||||||
|
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||||
|
IsVisible="{Binding $self.Content, Converter={x:Static ObjectConverters.IsNotNull}}" />
|
||||||
|
</Grid>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter>
|
||||||
|
|
||||||
|
<Style Selector="^:pointerover">
|
||||||
|
<Setter Property="BorderBrush"
|
||||||
|
Value="{DynamicResource SecondaryBorderBrush}" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="^:pressed:checked">
|
||||||
|
<Setter Property="Opacity"
|
||||||
|
Value=".8" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="^:pressed:unchecked">
|
||||||
|
<Setter Property="BorderBrush"
|
||||||
|
Value="{DynamicResource PrimaryBrush}" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="^:disabled">
|
||||||
|
<Setter Property="Opacity"
|
||||||
|
Value="0.4" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^:checked">
|
||||||
|
<Setter Property="Background"
|
||||||
|
Value="{DynamicResource PrimaryBrush}" />
|
||||||
|
<Setter Property="BorderBrush"
|
||||||
|
Value="{DynamicResource DarkPrimaryBrush}" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="^:checked /template/ Ellipse">
|
||||||
|
<Setter Property="RenderTransform"
|
||||||
|
Value="scale(1)" />
|
||||||
|
</Style>
|
||||||
|
</ControlTheme>
|
||||||
|
|
||||||
|
<ControlTheme x:Key="{x:Type RadioButton}"
|
||||||
|
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>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<ControlTheme x:Key="RadioButtonSameAsButtonPrimary"
|
||||||
|
BasedOn="{StaticResource RadioButtonSameAsButtonBaseStyle}"
|
||||||
|
TargetType="RadioButton">
|
||||||
|
<Setter Property="Background"
|
||||||
|
Value="{DynamicResource PrimaryBrush}" />
|
||||||
|
<Setter Property="BorderBrush"
|
||||||
|
Value="{DynamicResource PrimaryBrush}" />
|
||||||
|
</ControlTheme>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<ControlTheme x:Key="RadioButtonSameAsButtonSuccess"
|
||||||
|
BasedOn="{StaticResource RadioButtonSameAsButtonBaseStyle}"
|
||||||
|
TargetType="RadioButton">
|
||||||
|
<Setter Property="Background"
|
||||||
|
Value="{DynamicResource SuccessBrush}" />
|
||||||
|
<Setter Property="BorderBrush"
|
||||||
|
Value="{DynamicResource SuccessBrush}" />
|
||||||
|
</ControlTheme>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<ControlTheme x:Key="RadioButtonSameAsButtonInfo"
|
||||||
|
BasedOn="{StaticResource RadioButtonSameAsButtonBaseStyle}"
|
||||||
|
TargetType="RadioButton">
|
||||||
|
<Setter Property="Background"
|
||||||
|
Value="{DynamicResource InfoBrush}" />
|
||||||
|
<Setter Property="BorderBrush"
|
||||||
|
Value="{DynamicResource InfoBrush}" />
|
||||||
|
</ControlTheme>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<ControlTheme x:Key="RadioButtonSameAsButtonWarning"
|
||||||
|
BasedOn="{StaticResource RadioButtonSameAsButtonBaseStyle}"
|
||||||
|
TargetType="RadioButton">
|
||||||
|
<Setter Property="Background"
|
||||||
|
Value="{DynamicResource WarningBrush}" />
|
||||||
|
<Setter Property="BorderBrush"
|
||||||
|
Value="{DynamicResource WarningBrush}" />
|
||||||
|
</ControlTheme>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<ControlTheme x:Key="RadioButtonSameAsButtonDanger"
|
||||||
|
BasedOn="{StaticResource RadioButtonSameAsButtonBaseStyle}"
|
||||||
|
TargetType="RadioButton">
|
||||||
|
<Setter Property="Background"
|
||||||
|
Value="{DynamicResource DangerBrush}" />
|
||||||
|
<Setter Property="BorderBrush"
|
||||||
|
Value="{DynamicResource DangerBrush}" />
|
||||||
|
</ControlTheme>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<ControlTheme x:Key="RadioButtonIconBaseStyle"
|
||||||
|
BasedOn="{StaticResource ButtonBaseStyle}"
|
||||||
|
TargetType="RadioButton">
|
||||||
|
<Setter Property="Foreground"
|
||||||
|
Value="{DynamicResource PrimaryTextBrush}" />
|
||||||
|
<Setter Property="hc:BorderElement.CornerRadius"
|
||||||
|
Value="0" />
|
||||||
|
<Setter Property="hc:VisualElement.HighlightBrush"
|
||||||
|
Value="{DynamicResource PrimaryBrush}" />
|
||||||
|
<Setter Property="Template">
|
||||||
|
<ControlTemplate>
|
||||||
|
<Panel>
|
||||||
|
<Border CornerRadius="{TemplateBinding CornerRadius}"
|
||||||
|
Background="{TemplateBinding Background}"
|
||||||
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
|
BorderBrush="{TemplateBinding BorderBrush}">
|
||||||
|
<StackPanel Orientation="Horizontal"
|
||||||
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
|
Margin="{TemplateBinding Padding}">
|
||||||
|
<Path Height="{TemplateBinding hc:IconElement.Height}"
|
||||||
|
Width="{TemplateBinding hc:IconElement.Width}"
|
||||||
|
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}"
|
||||||
|
Margin="{Binding Path=(hc:IconElement.Geometry), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource GeometrySpacingConverter}, ConverterParameter='6,0,0,0'}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
<Border x:Name="BorderHighlight"
|
||||||
|
BorderThickness="3,0,0,0"
|
||||||
|
BorderBrush="Transparent"
|
||||||
|
IsVisible="{TemplateBinding IsChecked}" />
|
||||||
|
</Panel>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter>
|
||||||
|
|
||||||
|
<Style Selector="^:checked /template/ Border#BorderHighlight">
|
||||||
|
<Setter Property="BorderBrush"
|
||||||
|
Value="{Binding Path=(hc:VisualElement.HighlightBrush), RelativeSource={RelativeSource TemplatedParent}}" />
|
||||||
|
</Style>
|
||||||
|
</ControlTheme>
|
||||||
|
|
||||||
|
<ControlTheme x:Key="RadioButtonIcon"
|
||||||
|
BasedOn="{StaticResource RadioButtonIconBaseStyle}"
|
||||||
|
TargetType="RadioButton" />
|
||||||
|
|
||||||
|
<ControlTheme x:Key="RadioButtonIcon.Small"
|
||||||
|
BasedOn="{StaticResource RadioButtonIcon}"
|
||||||
|
TargetType="RadioButton">
|
||||||
|
<Setter Property="Height"
|
||||||
|
Value="20" />
|
||||||
|
<Setter Property="Padding"
|
||||||
|
Value="6,1" />
|
||||||
|
<Setter Property="hc:IconElement.Height"
|
||||||
|
Value="12" />
|
||||||
|
</ControlTheme>
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
Value="{Binding $self.(hc:BorderElement.CornerRadius)}" />
|
Value="{Binding $self.(hc:BorderElement.CornerRadius)}" />
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate>
|
<ControlTemplate>
|
||||||
<Grid>
|
<Panel>
|
||||||
<Border Background="{TemplateBinding Background}"
|
<Border Background="{TemplateBinding Background}"
|
||||||
CornerRadius="{TemplateBinding CornerRadius}" />
|
CornerRadius="{TemplateBinding CornerRadius}" />
|
||||||
<Border BorderThickness="{TemplateBinding BorderThickness}"
|
<Border BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
Margin="{Binding Path=(hc:IconElement.Geometry), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource GeometrySpacingConverter}, ConverterParameter='6,0,0,0'}" />
|
Margin="{Binding Path=(hc:IconElement.Geometry), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource GeometrySpacingConverter}, ConverterParameter='6,0,0,0'}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
</Grid>
|
</Panel>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/Window.axaml" />
|
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/Window.axaml" />
|
||||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/Button.axaml" />
|
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/Button.axaml" />
|
||||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/RepeatButton.axaml" />
|
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/RepeatButton.axaml" />
|
||||||
|
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/RadioButton.axaml" />
|
||||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/Border.axaml" />
|
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/Border.axaml" />
|
||||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/ItemsControl.axaml" />
|
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/ItemsControl.axaml" />
|
||||||
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/TabItem.axaml" />
|
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/TabItem.axaml" />
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3049,14 +3049,15 @@
|
|||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<ControlTemplate TargetType="RadioButton">
|
<ControlTemplate TargetType="RadioButton">
|
||||||
<Border CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
|
<hc:SimplePanel>
|
||||||
<Border Name="BorderHighlight" BorderThickness="3,0,0,0" BorderBrush="Transparent">
|
<Border CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}">
|
||||||
<Path x:Name="PathMain" Height="{Binding Path=(hc:IconElement.Height),RelativeSource={RelativeSource TemplatedParent}}" Width="{Binding Path=(hc:IconElement.Width),RelativeSource={RelativeSource TemplatedParent}}" Fill="{TemplateBinding Foreground}" SnapsToDevicePixels="True" Stretch="Uniform" Data="{TemplateBinding hc:IconElement.Geometry}" />
|
<Path x:Name="PathMain" Height="{Binding Path=(hc:IconElement.Height),RelativeSource={RelativeSource TemplatedParent}}" Width="{Binding Path=(hc:IconElement.Width),RelativeSource={RelativeSource TemplatedParent}}" Fill="{TemplateBinding Foreground}" SnapsToDevicePixels="True" Stretch="Uniform" Data="{TemplateBinding hc:IconElement.Geometry}" />
|
||||||
<ContentPresenter x:Name="ContentPresenterMain" RecognizesAccessKey="True" VerticalAlignment="Center" Margin="6,0,0,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
<ContentPresenter x:Name="ContentPresenterMain" RecognizesAccessKey="True" VerticalAlignment="Center" Margin="6,0,0,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
</Border>
|
<Border Name="BorderHighlight" BorderThickness="3,0,0,0" BorderBrush="Transparent" />
|
||||||
|
</hc:SimplePanel>
|
||||||
<ControlTemplate.Triggers>
|
<ControlTemplate.Triggers>
|
||||||
<Trigger Property="Content" Value="{x:Null}">
|
<Trigger Property="Content" Value="{x:Null}">
|
||||||
<Setter Property="Visibility" Value="Collapsed" TargetName="ContentPresenterMain" />
|
<Setter Property="Visibility" Value="Collapsed" TargetName="ContentPresenterMain" />
|
||||||
|
|||||||
@@ -115,19 +115,19 @@
|
|||||||
</WrapPanel>
|
</WrapPanel>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:UniformSpacingPanel Orientation="Vertical" Spacing="32">
|
<hc:UniformSpacingPanel Orientation="Vertical" Spacing="32">
|
||||||
<StackPanel>
|
<hc:UniformSpacingPanel Spacing="10" Orientation="Vertical">
|
||||||
<RadioButton IsChecked="True" Content="{ex:Lang Key={x:Static langs:LangKeys.RadioButton}}"/>
|
<RadioButton IsChecked="True" Content="{ex:Lang Key={x:Static langs:LangKeys.RadioButton}}"/>
|
||||||
<RadioButton Margin="0,16,0,0" Content="{ex:Lang Key={x:Static langs:LangKeys.RadioButton}}" IsEnabled="False"/>
|
<RadioButton Content="{ex:Lang Key={x:Static langs:LangKeys.RadioButton}}" IsEnabled="False"/>
|
||||||
<RadioButton Margin="0,16,0,0" Content="{ex:Lang Key={x:Static langs:LangKeys.RadioButton}}"/>
|
<RadioButton Content="{ex:Lang Key={x:Static langs:LangKeys.RadioButton}}"/>
|
||||||
<RadioButton Margin="0,16,0,0" Content="{ex:Lang Key={x:Static langs:LangKeys.RadioButton}}" IsEnabled="False"/>
|
<RadioButton Content="{ex:Lang Key={x:Static langs:LangKeys.RadioButton}}" IsEnabled="False"/>
|
||||||
</StackPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:UniformSpacingPanel Spacing="10">
|
<hc:UniformSpacingPanel Spacing="10" Orientation="Vertical">
|
||||||
<RadioButton Background="{DynamicResource SecondaryRegionBrush}" hc:IconElement.Geometry="{StaticResource CalendarGeometry}" Style="{StaticResource RadioButtonIcon}" Content="{ex:Lang Key={x:Static langs:LangKeys.RadioButton}}"/>
|
<RadioButton Background="{DynamicResource SecondaryRegionBrush}" hc:IconElement.Geometry="{StaticResource CalendarGeometry}" Style="{StaticResource RadioButtonIcon}" Content="{ex:Lang Key={x:Static langs:LangKeys.RadioButton}}"/>
|
||||||
<RadioButton Background="{DynamicResource SecondaryRegionBrush}" Style="{StaticResource RadioButtonIcon}" Content="{ex:Lang Key={x:Static langs:LangKeys.RadioButton}}" IsChecked="True"/>
|
<RadioButton Background="{DynamicResource SecondaryRegionBrush}" Style="{StaticResource RadioButtonIcon}" Content="{ex:Lang Key={x:Static langs:LangKeys.RadioButton}}" IsChecked="True"/>
|
||||||
<RadioButton hc:IconElement.Geometry="{StaticResource CalendarGeometry}" Style="{StaticResource RadioButtonIcon}" Content="{ex:Lang Key={x:Static langs:LangKeys.RadioButton}}"/>
|
<RadioButton hc:IconElement.Geometry="{StaticResource CalendarGeometry}" Style="{StaticResource RadioButtonIcon}" Content="{ex:Lang Key={x:Static langs:LangKeys.RadioButton}}"/>
|
||||||
<RadioButton Style="{StaticResource RadioButtonIcon}" Content="{ex:Lang Key={x:Static langs:LangKeys.RadioButton}}"/>
|
<RadioButton Style="{StaticResource RadioButtonIcon}" Content="{ex:Lang Key={x:Static langs:LangKeys.RadioButton}}"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:UniformSpacingPanel Spacing="10">
|
<hc:UniformSpacingPanel Spacing="10" Orientation="Vertical">
|
||||||
<RadioButton Background="{DynamicResource SecondaryRegionBrush}" hc:IconElement.Geometry="{StaticResource CalendarGeometry}" Style="{StaticResource RadioButtonIcon.Small}" Content="{ex:Lang Key={x:Static langs:LangKeys.RadioButton}}"/>
|
<RadioButton Background="{DynamicResource SecondaryRegionBrush}" hc:IconElement.Geometry="{StaticResource CalendarGeometry}" Style="{StaticResource RadioButtonIcon.Small}" Content="{ex:Lang Key={x:Static langs:LangKeys.RadioButton}}"/>
|
||||||
<RadioButton Background="{DynamicResource SecondaryRegionBrush}" Style="{StaticResource RadioButtonIcon.Small}" Content="{ex:Lang Key={x:Static langs:LangKeys.RadioButton}}" IsChecked="True"/>
|
<RadioButton Background="{DynamicResource SecondaryRegionBrush}" Style="{StaticResource RadioButtonIcon.Small}" Content="{ex:Lang Key={x:Static langs:LangKeys.RadioButton}}" IsChecked="True"/>
|
||||||
<RadioButton hc:IconElement.Geometry="{StaticResource CalendarGeometry}" Style="{StaticResource RadioButtonIcon.Small}" Content="{ex:Lang Key={x:Static langs:LangKeys.RadioButton}}"/>
|
<RadioButton hc:IconElement.Geometry="{StaticResource CalendarGeometry}" Style="{StaticResource RadioButtonIcon.Small}" Content="{ex:Lang Key={x:Static langs:LangKeys.RadioButton}}"/>
|
||||||
|
|||||||
@@ -157,14 +157,15 @@
|
|||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<ControlTemplate TargetType="RadioButton">
|
<ControlTemplate TargetType="RadioButton">
|
||||||
<Border CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
|
<hc:SimplePanel>
|
||||||
<Border Name="BorderHighlight" BorderThickness="3,0,0,0" BorderBrush="Transparent">
|
<Border CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}">
|
||||||
<Path x:Name="PathMain" Height="{Binding Path=(hc:IconElement.Height),RelativeSource={RelativeSource TemplatedParent}}" Width="{Binding Path=(hc:IconElement.Width),RelativeSource={RelativeSource TemplatedParent}}" Fill="{TemplateBinding Foreground}" SnapsToDevicePixels="True" Stretch="Uniform" Data="{TemplateBinding hc:IconElement.Geometry}" />
|
<Path x:Name="PathMain" Height="{Binding Path=(hc:IconElement.Height),RelativeSource={RelativeSource TemplatedParent}}" Width="{Binding Path=(hc:IconElement.Width),RelativeSource={RelativeSource TemplatedParent}}" Fill="{TemplateBinding Foreground}" SnapsToDevicePixels="True" Stretch="Uniform" Data="{TemplateBinding hc:IconElement.Geometry}" />
|
||||||
<ContentPresenter x:Name="ContentPresenterMain" RecognizesAccessKey="True" VerticalAlignment="Center" Margin="6,0,0,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
<ContentPresenter x:Name="ContentPresenterMain" RecognizesAccessKey="True" VerticalAlignment="Center" Margin="6,0,0,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
</Border>
|
<Border Name="BorderHighlight" BorderThickness="3,0,0,0" BorderBrush="Transparent" />
|
||||||
|
</hc:SimplePanel>
|
||||||
<ControlTemplate.Triggers>
|
<ControlTemplate.Triggers>
|
||||||
<Trigger Property="Content" Value="{x:Null}">
|
<Trigger Property="Content" Value="{x:Null}">
|
||||||
<Setter Property="Visibility" Value="Collapsed" TargetName="ContentPresenterMain" />
|
<Setter Property="Visibility" Value="Collapsed" TargetName="ContentPresenterMain" />
|
||||||
|
|||||||
@@ -3049,14 +3049,15 @@
|
|||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<ControlTemplate TargetType="RadioButton">
|
<ControlTemplate TargetType="RadioButton">
|
||||||
<Border CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
|
<hc:SimplePanel>
|
||||||
<Border Name="BorderHighlight" BorderThickness="3,0,0,0" BorderBrush="Transparent">
|
<Border CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}">
|
||||||
<Path x:Name="PathMain" Height="{Binding Path=(hc:IconElement.Height),RelativeSource={RelativeSource TemplatedParent}}" Width="{Binding Path=(hc:IconElement.Width),RelativeSource={RelativeSource TemplatedParent}}" Fill="{TemplateBinding Foreground}" SnapsToDevicePixels="True" Stretch="Uniform" Data="{TemplateBinding hc:IconElement.Geometry}" />
|
<Path x:Name="PathMain" Height="{Binding Path=(hc:IconElement.Height),RelativeSource={RelativeSource TemplatedParent}}" Width="{Binding Path=(hc:IconElement.Width),RelativeSource={RelativeSource TemplatedParent}}" Fill="{TemplateBinding Foreground}" SnapsToDevicePixels="True" Stretch="Uniform" Data="{TemplateBinding hc:IconElement.Geometry}" />
|
||||||
<ContentPresenter x:Name="ContentPresenterMain" RecognizesAccessKey="True" VerticalAlignment="Center" Margin="6,0,0,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
<ContentPresenter x:Name="ContentPresenterMain" RecognizesAccessKey="True" VerticalAlignment="Center" Margin="6,0,0,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
</Border>
|
<Border Name="BorderHighlight" BorderThickness="3,0,0,0" BorderBrush="Transparent" />
|
||||||
|
</hc:SimplePanel>
|
||||||
<ControlTemplate.Triggers>
|
<ControlTemplate.Triggers>
|
||||||
<Trigger Property="Content" Value="{x:Null}">
|
<Trigger Property="Content" Value="{x:Null}">
|
||||||
<Setter Property="Visibility" Value="Collapsed" TargetName="ContentPresenterMain" />
|
<Setter Property="Visibility" Value="Collapsed" TargetName="ContentPresenterMain" />
|
||||||
|
|||||||
Reference in new issue
Block a user