74 lines
1.6 KiB
C#
74 lines
1.6 KiB
C#
namespace Melskin.Controls;
|
||
|
||
using System.Windows;
|
||
using System.Windows.Controls;
|
||
|
||
/// <summary>
|
||
/// 表示一个标题控件,继承自 TextBlock,用于显示不同大小的标题文本。
|
||
/// </summary>
|
||
public class Heading : TextBlock
|
||
{
|
||
#region Properties
|
||
|
||
/// <summary>
|
||
/// 获取或设置标题的大小。
|
||
/// </summary>
|
||
public static readonly DependencyProperty SizeProperty =
|
||
DependencyProperty.Register(nameof(Size), typeof(HeadingSizes), typeof(Heading), new PropertyMetadata(HeadingSizes.Normal));
|
||
|
||
/// <summary>
|
||
/// Gets/sets the size of the heading.
|
||
/// </summary>
|
||
public HeadingSizes Size
|
||
{
|
||
get => (HeadingSizes)GetValue(SizeProperty);
|
||
set => SetValue(SizeProperty, value);
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region Constructors
|
||
|
||
static Heading()
|
||
{
|
||
DefaultStyleKeyProperty.OverrideMetadata(typeof(Heading), new FrameworkPropertyMetadata(typeof(Heading)));
|
||
}
|
||
|
||
#endregion
|
||
}
|
||
|
||
/// <summary>
|
||
/// 定义了标题的不同大小选项。
|
||
/// </summary>
|
||
public enum HeadingSizes : byte
|
||
{
|
||
/// <summary>
|
||
/// 表示标题的额外大尺寸选项。
|
||
/// </summary>
|
||
ExtraLarge,
|
||
|
||
/// <summary>
|
||
/// 表示标题的大尺寸选项。
|
||
/// </summary>
|
||
Large,
|
||
|
||
/// <summary>
|
||
/// 表示标题的中等尺寸选项。
|
||
/// </summary>
|
||
Medium,
|
||
|
||
/// <summary>
|
||
/// 表示标题的正常尺寸选项。
|
||
/// </summary>
|
||
Normal,
|
||
|
||
/// <summary>
|
||
/// 表示标题的小尺寸选项。
|
||
/// </summary>
|
||
Small,
|
||
|
||
/// <summary>
|
||
/// 表示标题的最小尺寸选项。
|
||
/// </summary>
|
||
Tiny
|
||
} |