Files
ShrlAlgoToolkit/WPFluent/Extensions/TextBlockFontTypographyExtensions.cs

35 lines
1.2 KiB
C#

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),
};
}
}