From 53a48fbe19787c700ddf9f574f5dabcf7b5350a1 Mon Sep 17 00:00:00 2001 From: Juan Osorio Date: Wed, 20 Nov 2024 17:31:37 -0800 Subject: [PATCH] MarkdownTextBlock: Minor style improvements --- .../src/TextElements/MyHeading.cs | 1 + .../MarkdownTextBlock/src/TextElements/MyList.cs | 7 +++++-- .../src/TextElements/MyThematicBreak.cs | 16 ++++++++-------- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/components/MarkdownTextBlock/src/TextElements/MyHeading.cs b/components/MarkdownTextBlock/src/TextElements/MyHeading.cs index f06c62413..1550aef38 100644 --- a/components/MarkdownTextBlock/src/TextElements/MyHeading.cs +++ b/components/MarkdownTextBlock/src/TextElements/MyHeading.cs @@ -47,6 +47,7 @@ public MyHeading(HeadingBlock headingBlock, MarkdownConfig config) 5 => _config.Themes.H5FontWeight, _ => _config.Themes.H6FontWeight, }; + _paragraph.Margin = new Thickness(left: 0, top: 14, right: 0, bottom: 0); } public MyHeading(HtmlNode htmlNode, MarkdownConfig config) diff --git a/components/MarkdownTextBlock/src/TextElements/MyList.cs b/components/MarkdownTextBlock/src/TextElements/MyList.cs index fc381008b..46b15e1a8 100644 --- a/components/MarkdownTextBlock/src/TextElements/MyList.cs +++ b/components/MarkdownTextBlock/src/TextElements/MyList.cs @@ -45,6 +45,7 @@ public MyList(ListBlock listBlock) } _stackPanel.Orientation = Orientation.Vertical; + _stackPanel.Margin = new Thickness(left: 0, top: 8, right: 0, bottom: 8); _container.Child = _stackPanel; _paragraph.Inlines.Add(_container); } @@ -52,7 +53,8 @@ public MyList(ListBlock listBlock) public void AddChild(IAddChild child) { var grid = new Grid(); - grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Auto) }); + grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(20, GridUnitType.Pixel) }); + grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(10, GridUnitType.Pixel) }); grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); string bullet; if (_isOrdered) @@ -79,11 +81,12 @@ public void AddChild(IAddChild child) }; textBlock.SetValue(Grid.ColumnProperty, 0); textBlock.VerticalAlignment = VerticalAlignment.Top; + textBlock.TextAlignment = TextAlignment.Right; grid.Children.Add(textBlock); var flowDoc = new MyFlowDocument(); flowDoc.AddChild(child); - flowDoc.RichTextBlock.SetValue(Grid.ColumnProperty, 1); + flowDoc.RichTextBlock.SetValue(Grid.ColumnProperty, 2); flowDoc.RichTextBlock.Padding = new Thickness(0); flowDoc.RichTextBlock.VerticalAlignment = VerticalAlignment.Top; grid.Children.Add(flowDoc.RichTextBlock); diff --git a/components/MarkdownTextBlock/src/TextElements/MyThematicBreak.cs b/components/MarkdownTextBlock/src/TextElements/MyThematicBreak.cs index c1f945ca1..bc06491b9 100644 --- a/components/MarkdownTextBlock/src/TextElements/MyThematicBreak.cs +++ b/components/MarkdownTextBlock/src/TextElements/MyThematicBreak.cs @@ -22,14 +22,14 @@ public MyThematicBreak(ThematicBreakBlock thematicBreakBlock) _paragraph = new Paragraph(); var inlineUIContainer = new InlineUIContainer(); - var border = new Border(); - border.Width = 500; - border.BorderThickness = new Thickness(1); - border.Margin = new Thickness(0, 4, 0, 4); - border.BorderBrush = new SolidColorBrush(Colors.Gray); - border.Height = 1; - border.HorizontalAlignment = HorizontalAlignment.Stretch; - inlineUIContainer.Child = border; + Line line = new Line + { + Stretch = Stretch.Fill, + Stroke = new SolidColorBrush(Colors.Gray), + X2 = 1, + Margin = new Thickness(0, 12, 0, 12) + }; + inlineUIContainer.Child = line; _paragraph.Inlines.Add(inlineUIContainer); }