diff --git a/HandyControl/Controls/Attach/BackgroundSwitchElement.cs b/HandyControl/Controls/Attach/BackgroundSwitchElement.cs index c690435b..c305f080 100644 --- a/HandyControl/Controls/Attach/BackgroundSwitchElement.cs +++ b/HandyControl/Controls/Attach/BackgroundSwitchElement.cs @@ -3,7 +3,7 @@ using System.Windows.Media; namespace HandyControl.Controls { - public class BackgroundSwitchElement : DependencyObject + public class BackgroundSwitchElement { public static readonly DependencyProperty MouseHoverBackgroundProperty = DependencyProperty.RegisterAttached( "MouseHoverBackground", typeof(Brush), typeof(BackgroundSwitchElement), new FrameworkPropertyMetadata(Brushes.Transparent, FrameworkPropertyMetadataOptions.Inherits)); diff --git a/HandyControl/Controls/Attach/BorderElement.cs b/HandyControl/Controls/Attach/BorderElement.cs index 451095e1..05db296b 100644 --- a/HandyControl/Controls/Attach/BorderElement.cs +++ b/HandyControl/Controls/Attach/BorderElement.cs @@ -2,7 +2,7 @@ namespace HandyControl.Controls { - public class BorderElement : DependencyObject + public class BorderElement { public static readonly DependencyProperty CornerRadiusProperty = DependencyProperty.RegisterAttached( "CornerRadius", typeof(CornerRadius), typeof(BorderElement), new FrameworkPropertyMetadata(default(CornerRadius), FrameworkPropertyMetadataOptions.Inherits)); diff --git a/HandyControl/Controls/Attach/DataGridAttach.cs b/HandyControl/Controls/Attach/DataGridAttach.cs index 68416965..7d49181f 100644 --- a/HandyControl/Controls/Attach/DataGridAttach.cs +++ b/HandyControl/Controls/Attach/DataGridAttach.cs @@ -6,7 +6,7 @@ using HandyControl.Data; namespace HandyControl.Controls { - public class DataGridAttach : DependencyObject + public class DataGridAttach { public static readonly DependencyProperty TextColumnStyleProperty = DependencyProperty.RegisterAttached( "TextColumnStyle", typeof(Style), typeof(DataGridAttach), new PropertyMetadata(default(Style), OnTextColumnStyleChanged)); diff --git a/HandyControl/Controls/Attach/EdgeElement.cs b/HandyControl/Controls/Attach/EdgeElement.cs index 60c2a552..7103947c 100644 --- a/HandyControl/Controls/Attach/EdgeElement.cs +++ b/HandyControl/Controls/Attach/EdgeElement.cs @@ -1,10 +1,9 @@ using System.Windows; using HandyControl.Data; -// ReSharper disable once CheckNamespace namespace HandyControl.Controls { - public class EdgeElement : DependencyObject + public class EdgeElement { public static readonly DependencyProperty LeftContentProperty = DependencyProperty.RegisterAttached( "LeftContent", typeof(object), typeof(EdgeElement), new PropertyMetadata(default(object), OnEdgeContentChanged)); diff --git a/HandyControl/Controls/Attach/IconElement.cs b/HandyControl/Controls/Attach/IconElement.cs index 003da5da..9a39bbc1 100644 --- a/HandyControl/Controls/Attach/IconElement.cs +++ b/HandyControl/Controls/Attach/IconElement.cs @@ -1,22 +1,36 @@ using System.Windows; using System.Windows.Media; +using HandyControl.Data; -// ReSharper disable once CheckNamespace namespace HandyControl.Controls { - public class IconElement : DependencyObject + public class IconElement { public static readonly DependencyProperty GeometryProperty = DependencyProperty.RegisterAttached( "Geometry", typeof(Geometry), typeof(IconElement), new PropertyMetadata(default(Geometry))); public static void SetGeometry(DependencyObject element, Geometry value) - { - element.SetValue(GeometryProperty, value); - } + => element.SetValue(GeometryProperty, value); - public static Geometry GetGeometry(DependencyObject element) - { - return (Geometry)element.GetValue(GeometryProperty); - } + public static Geometry GetGeometry(DependencyObject element) + => (Geometry) element.GetValue(GeometryProperty); + + public static readonly DependencyProperty WidthProperty = DependencyProperty.RegisterAttached( + "Width", typeof(double), typeof(IconElement), new PropertyMetadata(ValueBoxes.Double0Box)); + + public static void SetWidth(DependencyObject element, double value) + => element.SetValue(WidthProperty, value); + + public static double GetWidth(DependencyObject element) + => (double) element.GetValue(WidthProperty); + + public static readonly DependencyProperty HeightProperty = DependencyProperty.RegisterAttached( + "Height", typeof(double), typeof(IconElement), new PropertyMetadata(ValueBoxes.Double0Box)); + + public static void SetHeight(DependencyObject element, double value) + => element.SetValue(HeightProperty, value); + + public static double GetHeight(DependencyObject element) + => (double) element.GetValue(HeightProperty); } } \ No newline at end of file diff --git a/HandyControl/Controls/Attach/IconSwitchElement.cs b/HandyControl/Controls/Attach/IconSwitchElement.cs index 0b6f8a9a..8bdcfb2d 100644 --- a/HandyControl/Controls/Attach/IconSwitchElement.cs +++ b/HandyControl/Controls/Attach/IconSwitchElement.cs @@ -1,10 +1,9 @@ using System.Windows; using System.Windows.Media; -// ReSharper disable once CheckNamespace namespace HandyControl.Controls { - public class IconSwitchElement : DependencyObject + public class IconSwitchElement { public static readonly DependencyProperty GeometryProperty = DependencyProperty.RegisterAttached( "Geometry", typeof(Geometry), typeof(IconSwitchElement), new PropertyMetadata(default(Geometry))); diff --git a/HandyControl/Controls/Attach/InfoElement.cs b/HandyControl/Controls/Attach/InfoElement.cs index 96556197..73777651 100644 --- a/HandyControl/Controls/Attach/InfoElement.cs +++ b/HandyControl/Controls/Attach/InfoElement.cs @@ -1,10 +1,9 @@ using System.Windows; using HandyControl.Data; -// ReSharper disable once CheckNamespace namespace HandyControl.Controls { - public class InfoElement : DependencyObject + public class InfoElement { /// /// 标题 diff --git a/HandyControl/Controls/Attach/PasswordBoxMonitor.cs b/HandyControl/Controls/Attach/PasswordBoxMonitor.cs index 0e78d619..450613f2 100644 --- a/HandyControl/Controls/Attach/PasswordBoxMonitor.cs +++ b/HandyControl/Controls/Attach/PasswordBoxMonitor.cs @@ -1,7 +1,6 @@ using System.Windows; using HandyControl.Data; -// ReSharper disable once CheckNamespace namespace HandyControl.Controls { public class PasswordBoxMonitor diff --git a/HandyControl/Controls/Attach/StatusSwitchElement.cs b/HandyControl/Controls/Attach/StatusSwitchElement.cs index b1e8e74a..350c82d9 100644 --- a/HandyControl/Controls/Attach/StatusSwitchElement.cs +++ b/HandyControl/Controls/Attach/StatusSwitchElement.cs @@ -1,7 +1,6 @@ using System.Windows; using HandyControl.Data; -// ReSharper disable once CheckNamespace namespace HandyControl.Controls { public class StatusSwitchElement diff --git a/HandyControl/Controls/Attach/TipElement.cs b/HandyControl/Controls/Attach/TipElement.cs index ca3f9caa..5fa5481f 100644 --- a/HandyControl/Controls/Attach/TipElement.cs +++ b/HandyControl/Controls/Attach/TipElement.cs @@ -1,10 +1,9 @@ using System.Windows; using HandyControl.Data; -// ReSharper disable once CheckNamespace namespace HandyControl.Controls { - public class TipElement : DependencyObject + public class TipElement { public static readonly DependencyProperty VisibilityProperty = DependencyProperty.RegisterAttached( "Visibility", typeof(Visibility), typeof(TipElement), new PropertyMetadata(Visibility.Collapsed)); diff --git a/HandyControl/Controls/Attach/TitleElement.cs b/HandyControl/Controls/Attach/TitleElement.cs index 5fab90ea..14415c6f 100644 --- a/HandyControl/Controls/Attach/TitleElement.cs +++ b/HandyControl/Controls/Attach/TitleElement.cs @@ -3,7 +3,7 @@ using System.Windows.Media; namespace HandyControl.Controls { - public class TitleElement : DependencyObject + public class TitleElement { public static readonly DependencyProperty BackgroundProperty = DependencyProperty.RegisterAttached( "Background", typeof(Brush), typeof(TitleElement), new FrameworkPropertyMetadata(default(Brush), FrameworkPropertyMetadataOptions.Inherits)); diff --git a/HandyControl/Controls/Attach/VisualElement.cs b/HandyControl/Controls/Attach/VisualElement.cs new file mode 100644 index 00000000..511922bc --- /dev/null +++ b/HandyControl/Controls/Attach/VisualElement.cs @@ -0,0 +1,17 @@ +using System.Windows; +using System.Windows.Media; + +namespace HandyControl.Controls +{ + public class VisualElement + { + public static readonly DependencyProperty HighlightBrushProperty = DependencyProperty.RegisterAttached( + "HighlightBrush", typeof(Brush), typeof(VisualElement), new PropertyMetadata(default(Brush))); + + public static void SetHighlightBrush(DependencyObject element, Brush value) + => element.SetValue(HighlightBrushProperty, value); + + public static Brush GetHighlightBrush(DependencyObject element) + => (Brush) element.GetValue(HighlightBrushProperty); + } +} \ No newline at end of file diff --git a/HandyControl/Data/ValueBoxes.cs b/HandyControl/Data/ValueBoxes.cs index b1d1aef2..ece11652 100644 --- a/HandyControl/Data/ValueBoxes.cs +++ b/HandyControl/Data/ValueBoxes.cs @@ -1,7 +1,7 @@ namespace HandyControl.Data { /// - /// 装箱后的布尔值(用于提高效率) + /// 装箱后的值类型(用于提高效率) /// internal static class ValueBoxes { diff --git a/HandyControl/HandyControl.csproj b/HandyControl/HandyControl.csproj index 3ed59c27..60c9cd5a 100644 --- a/HandyControl/HandyControl.csproj +++ b/HandyControl/HandyControl.csproj @@ -45,6 +45,7 @@ v4.6.2 + diff --git a/HandyControl/Themes/Styles/Base/RadioButtonBaseStyle.xaml b/HandyControl/Themes/Styles/Base/RadioButtonBaseStyle.xaml index d1b7764e..771c7a1a 100644 --- a/HandyControl/Themes/Styles/Base/RadioButtonBaseStyle.xaml +++ b/HandyControl/Themes/Styles/Base/RadioButtonBaseStyle.xaml @@ -94,6 +94,60 @@ + + - - \ No newline at end of file + diff --git a/HandyControlDemo/UserControl/Styles/RadioButtonDemoCtl.xaml b/HandyControlDemo/UserControl/Styles/RadioButtonDemoCtl.xaml index c3d7dd29..b162a657 100644 --- a/HandyControlDemo/UserControl/Styles/RadioButtonDemoCtl.xaml +++ b/HandyControlDemo/UserControl/Styles/RadioButtonDemoCtl.xaml @@ -1,17 +1,26 @@ - - - - - - + + + + + + + + + + + + + + +