2026-01-02 17:30:41 +08:00
|
|
|
|
namespace Melskin.Controls;
|
2025-08-20 12:10:13 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Divider 控件用于在用户界面中创建视觉分隔效果,可以是水平或垂直方向。它支持嵌入文本、图像或其他UI元素来提供额外的信息或装饰。
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class Divider : Control
|
|
|
|
|
|
{
|
|
|
|
|
|
static Divider()
|
|
|
|
|
|
{
|
|
|
|
|
|
DefaultStyleKeyProperty.OverrideMetadata(typeof(Divider), new FrameworkPropertyMetadata(typeof(Divider)));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 分割线内容
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 用于设置或获取Divider控件的内容属性。此属性允许用户在分割线中嵌入文本、图像或其他UI元素,以提供额外的信息或视觉分隔效果。
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public static readonly DependencyProperty ContentProperty =
|
|
|
|
|
|
DependencyProperty.Register(nameof(Content), typeof(object), typeof(Divider), new PropertyMetadata(null));
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 用于设置或获取Divider控件的内容属性。该属性允许在分割线中显示文本或其他类型的UI元素。
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public object Content
|
|
|
|
|
|
{
|
|
|
|
|
|
get => GetValue(ContentProperty);
|
|
|
|
|
|
set => SetValue(ContentProperty, value);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 方向 (水平/垂直)
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 用于设置或获取Divider控件的方向属性。该属性定义了分割线是水平还是垂直显示。
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public static readonly DependencyProperty OrientationProperty =
|
|
|
|
|
|
DependencyProperty.Register(nameof(Orientation), typeof(Orientation), typeof(Divider), new PropertyMetadata(Orientation.Horizontal));
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 用于设置或获取Divider控件的方向。该属性定义了分割线是水平还是垂直显示。
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public Orientation Orientation
|
|
|
|
|
|
{
|
|
|
|
|
|
get => (Orientation)GetValue(OrientationProperty);
|
|
|
|
|
|
set => SetValue(OrientationProperty, value);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 文本对齐 (左/中/右)
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 用于设置或获取Divider控件中文本的对齐方式。该属性定义了文本相对于其容器的对齐位置,可以是左对齐、居中或右对齐。
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public static readonly DependencyProperty TextOrientationProperty =
|
|
|
|
|
|
DependencyProperty.Register(nameof(TextOrientation), typeof(TextAlignment), typeof(Divider), new PropertyMetadata(TextAlignment.Center));
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
///
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public TextAlignment TextOrientation
|
|
|
|
|
|
{
|
|
|
|
|
|
get => (TextAlignment)GetValue(TextOrientationProperty);
|
|
|
|
|
|
set => SetValue(TextOrientationProperty, value);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// IsDashedProperty 已被移除
|
|
|
|
|
|
}
|