Files
ChrisKaczor.Wpf.Controls.Ht…/TextFragmentStyle.cs
2023-04-07 13:35:10 -04:00

32 lines
834 B
C#

using System.Windows;
using System.Windows.Media;
namespace ChrisKaczor.Wpf.Controls
{
public class TextFragmentStyle
{
public Brush? Color { get; set; }
public FontStyle? Style { get; init; }
public FontWeight? Weight { get; init; }
public double? Size { get; set; }
public bool? Underline { get; init; }
public void Apply(TextFragment fragment)
{
if (Color != null)
fragment.Color = Color;
if (Style.HasValue)
fragment.Style = Style.Value;
if (Weight.HasValue)
fragment.Weight = Weight.Value;
if (Size.HasValue)
fragment.Size = Size.Value;
if (Underline.HasValue)
fragment.Underline = Underline.Value;
}
}
}