mirror of
https://github.com/ckaczor/Common.Wpf.git
synced 2026-01-14 01:25:37 -05:00
Initial commit
This commit is contained in:
32
HtmlLabelControl/TextFragmentStyle.cs
Normal file
32
HtmlLabelControl/TextFragmentStyle.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Common.Wpf.HtmlLabelControl
|
||||
{
|
||||
public class TextFragmentStyle
|
||||
{
|
||||
public Brush Color { get; set; }
|
||||
public FontStyle? Style { get; set; }
|
||||
public FontWeight? Weight { get; set; }
|
||||
public double? Size { get; set; }
|
||||
public bool? Underline { get; set; }
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user