mirror of
https://github.com/ckaczor/ChrisKaczor.Wpf.Controls.HtmlTextBlock.git
synced 2026-01-13 17:22:31 -05:00
32 lines
834 B
C#
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;
|
|
}
|
|
}
|
|
} |