2025-02-10 20:53:40 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using WPFluent.Controls;
|
|
|
|
|
|
|
|
|
|
|
|
namespace WPFluent.Extensions;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Extension that converts the typography type enumeration to the name of the resource that represents it.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public static class TextBlockFontTypographyExtensions
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
2025-05-05 17:04:06 +08:00
|
|
|
|
/// 将 typography type 枚举转换为表示它的资源的名称。
|
2025-02-10 20:53:40 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns>
|
2025-05-05 17:04:06 +08:00
|
|
|
|
/// 与 <see cref="FontTypography"/> 匹配的资源名称。否则<see cref="ArgumentOutOfRangeException"/>。
|
2025-02-10 20:53:40 +08:00
|
|
|
|
/// </returns>
|
|
|
|
|
|
public static string ToResourceValue(this FontTypography typography)
|
|
|
|
|
|
{
|
|
|
|
|
|
return typography switch
|
|
|
|
|
|
{
|
|
|
|
|
|
FontTypography.Caption => "CaptionTextBlockStyle",
|
|
|
|
|
|
FontTypography.Body => "BodyTextBlockStyle",
|
|
|
|
|
|
FontTypography.BodyStrong => "BodyStrongTextBlockStyle",
|
|
|
|
|
|
FontTypography.Subtitle => "SubtitleTextBlockStyle",
|
|
|
|
|
|
FontTypography.Title => "TitleTextBlockStyle",
|
|
|
|
|
|
FontTypography.TitleLarge => "TitleLargeTextBlockStyle",
|
|
|
|
|
|
FontTypography.Display => "DisplayTextBlockStyle",
|
|
|
|
|
|
_ => throw new ArgumentOutOfRangeException(nameof(typography), typography, null),
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|