Skip to content

Commit

Permalink
wpf: Apply text-alignment to TableCell and ListItem in addition to Block
Browse files Browse the repository at this point in the history
  • Loading branch information
mstefarov committed Jul 11, 2023
1 parent e5fcad7 commit 02db273
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,16 @@ private static void ApplyStyle(TextElement el, MarkupNode node)
el.Background = new SolidColorBrush(ConvertColor(node.BackColor.Value));
if (node.FontSize.HasValue)
el.FontSize = 16d * node.FontSize.Value; // based on AGOL's default font size
if (node.Alignment.HasValue && el is Block blockEl)
blockEl.TextAlignment = ConvertAlignment(node.Alignment);
if (node.Alignment.HasValue)
{
// Unfortunately the TextAlignment property is separately defined for these FlowDocument elements
if (el is Block blockEl)
blockEl.TextAlignment = ConvertAlignment(node.Alignment);
else if (el is TableCell cellEl)
cellEl.TextAlignment = ConvertAlignment(node.Alignment);
else if (el is ListItem itemEl)
itemEl.TextAlignment = ConvertAlignment(node.Alignment);
}
if (node.IsUnderline.HasValue)
{
if (el is Inline inlineEl)
Expand Down

0 comments on commit 02db273

Please sign in to comment.