优化更新代码,添加界面功能并整合
This commit is contained in:
34
WPFluent/Extensions/TextBlockFontTypographyExtensions.cs
Normal file
34
WPFluent/Extensions/TextBlockFontTypographyExtensions.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
|
||||
|
||||
|
||||
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>
|
||||
/// Converts the typography type enumeration to the name of the resource that represents it.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// Name of the resource matching the <see cref="FontTypography"/>. <see cref="ArgumentOutOfRangeException"/>
|
||||
/// otherwise.
|
||||
/// </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),
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user