namespace Melskin.Controls.Decorations; /// /// SlotBorder 类继承自 DecorationBase,用于为控件添加具有圆角和阴影效果的装饰边框。 /// 通过设置 CornerRadius 属性可以控制边框的圆角程度,同时 LightShadowBrush 和 DarkShadowBrush 属性允许用户自定义浅色和深色阴影的颜色。 /// public class SlotBorder : DecorationBase { static SlotBorder() { DefaultStyleKeyProperty.OverrideMetadata(typeof(SlotBorder), new FrameworkPropertyMetadata(typeof(SlotBorder))); } /// /// 获取或设置边框的圆角半径。 /// public CornerRadius CornerRadius { get => (CornerRadius)GetValue(CornerRadiusProperty); set => SetValue(CornerRadiusProperty, value); } /// /// 高亮笔刷 /// public SolidColorBrush LightShadowBrush { get => (SolidColorBrush)GetValue(LightShadowBrushProperty); set => SetValue(LightShadowBrushProperty, value); } /// /// 阴影笔刷 /// public SolidColorBrush DarkShadowBrush { get => (SolidColorBrush)GetValue(DarkShadowBrushProperty); set => SetValue(DarkShadowBrushProperty, value); } #region Dependency Properties /// /// 用于定义边角半径的依赖属性,控制装饰控件的圆角程度。 /// public static readonly DependencyProperty CornerRadiusProperty = DependencyProperty.Register(nameof(CornerRadius), typeof(CornerRadius), typeof(SlotBorder), new PropertyMetadata(new CornerRadius(4))); /// /// 浅色阴影笔刷 /// public static readonly DependencyProperty LightShadowBrushProperty = DependencyProperty.Register(nameof(LightShadowBrush), typeof(SolidColorBrush), typeof(SlotBorder), new PropertyMetadata(Brushes.WhiteSmoke)); /// /// 深色阴影笔刷 /// public static readonly DependencyProperty DarkShadowBrushProperty = DependencyProperty.Register(nameof(DarkShadowBrush), typeof(SolidColorBrush), typeof(SlotBorder), new PropertyMetadata(Brushes.DarkGray)); #endregion }