diff --git a/HandyControl/Controls/Input/ImageRadioButton.cs b/HandyControl/Controls/Input/ImageRadioButton.cs new file mode 100644 index 00000000..616fa3ce --- /dev/null +++ b/HandyControl/Controls/Input/ImageRadioButton.cs @@ -0,0 +1,57 @@ +using HandyControl.Data; +using HandyControl.Tools; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Media; + +namespace HandyControl.Controls +{ + public class ImageRadioButton : RadioButton + { + public ImageRadioButton() + { + SetSideBrush(this, ResourceHelper.GetResource(ResourceToken.PrimaryBrush)); + } + public Geometry Image + { + get { return (Geometry)GetValue(ImageProperty); } + set { SetValue(ImageProperty, value); } + } + + public static readonly DependencyProperty ImageProperty = + DependencyProperty.Register("Image", typeof(Geometry), typeof(ImageRadioButton)); + + + + public double ImageWidth + { + get { return (double)GetValue(ImageWidthProperty); } + set { SetValue(ImageWidthProperty, value); } + } + + public static readonly DependencyProperty ImageWidthProperty = + DependencyProperty.Register("ImageWidth", typeof(double), typeof(ImageRadioButton), new PropertyMetadata(15.0)); + + public double ImageHeight + { + get { return (double)GetValue(ImageHeightProperty); } + set { SetValue(ImageHeightProperty, value); } + } + + public static readonly DependencyProperty ImageHeightProperty = + DependencyProperty.Register("ImageHeight", typeof(double), typeof(ImageRadioButton), new PropertyMetadata(15.0)); + + public static readonly DependencyProperty SideBrushProperty = DependencyProperty.RegisterAttached( + "SideBrush", typeof(Brush), typeof(ImageRadioButton), new FrameworkPropertyMetadata(Brushes.Transparent, FrameworkPropertyMetadataOptions.Inherits)); + + public static void SetSideBrush(DependencyObject element, Brush value) => element.SetValue(SideBrushProperty, value); + + public static Brush GetSideBrush(DependencyObject element) => (Brush)element.GetValue(SideBrushProperty); + + } +} diff --git a/HandyControl/HandyControl.csproj b/HandyControl/HandyControl.csproj index 78a8655f..a0f6d12f 100644 --- a/HandyControl/HandyControl.csproj +++ b/HandyControl/HandyControl.csproj @@ -45,6 +45,7 @@ v4.6.2 + diff --git a/HandyControl/Themes/Styles/Expander.xaml b/HandyControl/Themes/Styles/Expander.xaml index d25f1a09..e02c0427 100644 --- a/HandyControl/Themes/Styles/Expander.xaml +++ b/HandyControl/Themes/Styles/Expander.xaml @@ -52,4 +52,354 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/HandyControl/Themes/Styles/RadioButton.xaml b/HandyControl/Themes/Styles/RadioButton.xaml index 20051738..e4f3dd77 100644 --- a/HandyControl/Themes/Styles/RadioButton.xaml +++ b/HandyControl/Themes/Styles/RadioButton.xaml @@ -1,4 +1,5 @@  @@ -10,4 +11,64 @@ \ No newline at end of file diff --git a/HandyControlDemo/UserControl/Styles/RadioButtonDemoCtl.xaml b/HandyControlDemo/UserControl/Styles/RadioButtonDemoCtl.xaml index 011e72f3..b36fdfe1 100644 --- a/HandyControlDemo/UserControl/Styles/RadioButtonDemoCtl.xaml +++ b/HandyControlDemo/UserControl/Styles/RadioButtonDemoCtl.xaml @@ -6,11 +6,31 @@ Background="{DynamicResource RegionBrush}" Width="400"> - - - - - + + + + + + + + + + + + + + + + + + + + + + + + +