功能更新
This commit is contained in:
70
Melskin/Controls/Decorations/SlotBorder.xaml.cs
Normal file
70
Melskin/Controls/Decorations/SlotBorder.xaml.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
namespace Melskin.Controls.Decorations;
|
||||
|
||||
/// <summary>
|
||||
/// SlotBorder 类继承自 DecorationBase,用于为控件添加具有圆角和阴影效果的装饰边框。
|
||||
/// 通过设置 CornerRadius 属性可以控制边框的圆角程度,同时 LightShadowBrush 和 DarkShadowBrush 属性允许用户自定义浅色和深色阴影的颜色。
|
||||
/// </summary>
|
||||
public class SlotBorder : DecorationBase
|
||||
{
|
||||
static SlotBorder()
|
||||
{
|
||||
DefaultStyleKeyProperty.OverrideMetadata(typeof(SlotBorder),
|
||||
new FrameworkPropertyMetadata(typeof(SlotBorder)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置边框的圆角半径。
|
||||
/// </summary>
|
||||
public CornerRadius CornerRadius
|
||||
{
|
||||
get => (CornerRadius)GetValue(CornerRadiusProperty);
|
||||
set => SetValue(CornerRadiusProperty, value);
|
||||
}
|
||||
/// <summary>
|
||||
/// 高亮笔刷
|
||||
/// </summary>
|
||||
public SolidColorBrush LightShadowBrush
|
||||
{
|
||||
get => (SolidColorBrush)GetValue(LightShadowBrushProperty);
|
||||
set => SetValue(LightShadowBrushProperty, value);
|
||||
}
|
||||
/// <summary>
|
||||
/// 阴影笔刷
|
||||
/// </summary>
|
||||
public SolidColorBrush DarkShadowBrush
|
||||
{
|
||||
get => (SolidColorBrush)GetValue(DarkShadowBrushProperty);
|
||||
set => SetValue(DarkShadowBrushProperty, value);
|
||||
}
|
||||
|
||||
#region Dependency Properties
|
||||
|
||||
/// <summary>
|
||||
/// 用于定义边角半径的依赖属性,控制装饰控件的圆角程度。
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty CornerRadiusProperty =
|
||||
DependencyProperty.Register(nameof(CornerRadius),
|
||||
typeof(CornerRadius), typeof(SlotBorder),
|
||||
new PropertyMetadata(new CornerRadius(4)));
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 浅色阴影笔刷
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty LightShadowBrushProperty =
|
||||
DependencyProperty.Register(nameof(LightShadowBrush),
|
||||
typeof(SolidColorBrush), typeof(SlotBorder),
|
||||
new PropertyMetadata(Brushes.WhiteSmoke));
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 深色阴影笔刷
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty DarkShadowBrushProperty =
|
||||
DependencyProperty.Register(nameof(DarkShadowBrush),
|
||||
typeof(SolidColorBrush), typeof(SlotBorder),
|
||||
new PropertyMetadata(Brushes.DarkGray));
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user