diff --git a/src/Avalonia/HandyControlDemo_Avalonia/UserControl/Styles/RadioButtonDemoCtl.axaml b/src/Avalonia/HandyControlDemo_Avalonia/UserControl/Styles/RadioButtonDemoCtl.axaml new file mode 100644 index 00000000..f06468fd --- /dev/null +++ b/src/Avalonia/HandyControlDemo_Avalonia/UserControl/Styles/RadioButtonDemoCtl.axaml @@ -0,0 +1,344 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia/HandyControlDemo_Avalonia/UserControl/Styles/RadioButtonDemoCtl.axaml.cs b/src/Avalonia/HandyControlDemo_Avalonia/UserControl/Styles/RadioButtonDemoCtl.axaml.cs new file mode 100644 index 00000000..b20f6914 --- /dev/null +++ b/src/Avalonia/HandyControlDemo_Avalonia/UserControl/Styles/RadioButtonDemoCtl.axaml.cs @@ -0,0 +1,10 @@ +namespace HandyControlDemo.UserControl; + +public partial class RadioButtonDemoCtl : Avalonia.Controls.UserControl +{ + public RadioButtonDemoCtl() + { + InitializeComponent(); + } +} + diff --git a/src/Avalonia/HandyControl_Avalonia/Controls/Attach/VisualElement.cs b/src/Avalonia/HandyControl_Avalonia/Controls/Attach/VisualElement.cs new file mode 100644 index 00000000..ebbeea1c --- /dev/null +++ b/src/Avalonia/HandyControl_Avalonia/Controls/Attach/VisualElement.cs @@ -0,0 +1,50 @@ +using Avalonia; +using Avalonia.Media; + +namespace HandyControl.Controls; + +public class VisualElement +{ + public static readonly AttachedProperty HighlightBrushProperty = + AvaloniaProperty.RegisterAttached("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 HighlightBackgroundProperty = + AvaloniaProperty.RegisterAttached("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 HighlightBorderBrushProperty = + AvaloniaProperty.RegisterAttached("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 HighlightForegroundProperty = + AvaloniaProperty.RegisterAttached("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 TextProperty = + AvaloniaProperty.RegisterAttached("Text"); + + public static void SetText(AvaloniaObject element, string value) => element.SetValue(TextProperty, value); + + public static string GetText(AvaloniaObject element) => element.GetValue(TextProperty); +} diff --git a/src/Avalonia/HandyControl_Avalonia/Themes/Basic/Converters.axaml b/src/Avalonia/HandyControl_Avalonia/Themes/Basic/Converters.axaml index 1f8f8d11..75038c6f 100644 --- a/src/Avalonia/HandyControl_Avalonia/Themes/Basic/Converters.axaml +++ b/src/Avalonia/HandyControl_Avalonia/Themes/Basic/Converters.axaml @@ -2,8 +2,9 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:converter="clr-namespace:HandyControl.Tools.Converter"> + - + diff --git a/src/Avalonia/HandyControl_Avalonia/Themes/Styles/Button.axaml b/src/Avalonia/HandyControl_Avalonia/Themes/Styles/Button.axaml index 30ebcff1..2d8f6a0e 100644 --- a/src/Avalonia/HandyControl_Avalonia/Themes/Styles/Button.axaml +++ b/src/Avalonia/HandyControl_Avalonia/Themes/Styles/Button.axaml @@ -29,7 +29,7 @@ Value="{Binding $self.(hc:BorderElement.CornerRadius)}" /> - + - + diff --git a/src/Avalonia/HandyControl_Avalonia/Themes/Styles/RadioButton.axaml b/src/Avalonia/HandyControl_Avalonia/Themes/Styles/RadioButton.axaml new file mode 100644 index 00000000..276f44f7 --- /dev/null +++ b/src/Avalonia/HandyControl_Avalonia/Themes/Styles/RadioButton.axaml @@ -0,0 +1,334 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia/HandyControl_Avalonia/Themes/Styles/RepeatButton.axaml b/src/Avalonia/HandyControl_Avalonia/Themes/Styles/RepeatButton.axaml index 8f647014..96c0386f 100644 --- a/src/Avalonia/HandyControl_Avalonia/Themes/Styles/RepeatButton.axaml +++ b/src/Avalonia/HandyControl_Avalonia/Themes/Styles/RepeatButton.axaml @@ -29,7 +29,7 @@ Value="{Binding $self.(hc:BorderElement.CornerRadius)}" /> - + - + diff --git a/src/Avalonia/HandyControl_Avalonia/Themes/Styles/Style.axaml b/src/Avalonia/HandyControl_Avalonia/Themes/Styles/Style.axaml index 33c76506..7b41df30 100644 --- a/src/Avalonia/HandyControl_Avalonia/Themes/Styles/Style.axaml +++ b/src/Avalonia/HandyControl_Avalonia/Themes/Styles/Style.axaml @@ -15,6 +15,7 @@ + diff --git a/src/Avalonia/HandyControl_Avalonia/Tools/Converter/Boolean2BooleanReConverter.cs b/src/Avalonia/HandyControl_Avalonia/Tools/Converter/Boolean2BooleanReConverter.cs new file mode 100644 index 00000000..dd3a55fd --- /dev/null +++ b/src/Avalonia/HandyControl_Avalonia/Tools/Converter/Boolean2BooleanReConverter.cs @@ -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; + } +} diff --git a/src/Net_40/HandyControl_Net_40/Themes/Theme.xaml b/src/Net_40/HandyControl_Net_40/Themes/Theme.xaml index 74c858b9..23394238 100644 --- a/src/Net_40/HandyControl_Net_40/Themes/Theme.xaml +++ b/src/Net_40/HandyControl_Net_40/Themes/Theme.xaml @@ -3049,14 +3049,15 @@ - - + + - + + diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Styles/RadioButtonDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Styles/RadioButtonDemoCtl.xaml index cddf08a0..6e651c1d 100644 --- a/src/Shared/HandyControlDemo_Shared/UserControl/Styles/RadioButtonDemoCtl.xaml +++ b/src/Shared/HandyControlDemo_Shared/UserControl/Styles/RadioButtonDemoCtl.xaml @@ -115,19 +115,19 @@ - + - - - - - + + + + + - + diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/RadioButtonBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/RadioButtonBaseStyle.xaml index 8f56b2a5..35924710 100644 --- a/src/Shared/HandyControl_Shared/Themes/Styles/Base/RadioButtonBaseStyle.xaml +++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/RadioButtonBaseStyle.xaml @@ -157,14 +157,15 @@ - - + + - + + diff --git a/src/Shared/HandyControl_Shared/Themes/Theme.xaml b/src/Shared/HandyControl_Shared/Themes/Theme.xaml index ec19fbcf..6e04055b 100644 --- a/src/Shared/HandyControl_Shared/Themes/Theme.xaml +++ b/src/Shared/HandyControl_Shared/Themes/Theme.xaml @@ -3049,14 +3049,15 @@ - - + + - + +