Skip to content

Commit e85d867

Browse files
authored
Merge pull request #604 from jcoc611-microsoft/user/juosori/StyleFixes1
MarkdownTextBlock: Minor style improvements
2 parents 5624f79 + 10b4be9 commit e85d867

File tree

3 files changed

+19
-16
lines changed

3 files changed

+19
-16
lines changed

components/MarkdownTextBlock/src/MarkdownThemes.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ public sealed class MarkdownThemes : DependencyObject
4949

5050
public FontWeight H6FontWeight { get; set; } = FontWeights.Normal;
5151

52-
public Thickness H1Margin { get; set; } = new(0);
53-
public Thickness H2Margin { get; set; } = new(0);
54-
public Thickness H3Margin { get; set; } = new(0);
55-
public Thickness H4Margin { get; set; } = new(0);
56-
public Thickness H5Margin { get; set; } = new(0);
57-
public Thickness H6Margin { get; set; } = new(0);
52+
public Thickness H1Margin { get; set; } = new(left: 0, top: 14, right: 0, bottom: 0);
53+
public Thickness H2Margin { get; set; } = new(left: 0, top: 14, right: 0, bottom: 0);
54+
public Thickness H3Margin { get; set; } = new(left: 0, top: 14, right: 0, bottom: 0);
55+
public Thickness H4Margin { get; set; } = new(left: 0, top: 14, right: 0, bottom: 0);
56+
public Thickness H5Margin { get; set; } = new(left: 0, top: 8, right: 0, bottom: 0);
57+
public Thickness H6Margin { get; set; } = new(left: 0, top: 8, right: 0, bottom: 0);
5858

5959
public Brush InlineCodeBackground { get; set; } = (Brush)Application.Current.Resources["ExpanderHeaderBackground"];
6060
public Brush InlineCodeForeground { get; set; } = (Brush)Application.Current.Resources["TextFillColorPrimaryBrush"];

components/MarkdownTextBlock/src/TextElements/MyList.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,16 @@ public MyList(ListBlock listBlock)
4545
}
4646

4747
_stackPanel.Orientation = Orientation.Vertical;
48+
_stackPanel.Margin = new Thickness(left: 0, top: 8, right: 0, bottom: 8);
4849
_container.Child = _stackPanel;
4950
_paragraph.Inlines.Add(_container);
5051
}
5152

5253
public void AddChild(IAddChild child)
5354
{
5455
var grid = new Grid();
55-
grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Auto) });
56+
grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(20, GridUnitType.Pixel) });
57+
grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(10, GridUnitType.Pixel) });
5658
grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });
5759
string bullet;
5860
if (_isOrdered)
@@ -79,11 +81,12 @@ public void AddChild(IAddChild child)
7981
};
8082
textBlock.SetValue(Grid.ColumnProperty, 0);
8183
textBlock.VerticalAlignment = VerticalAlignment.Top;
84+
textBlock.TextAlignment = TextAlignment.Right;
8285
grid.Children.Add(textBlock);
8386
var flowDoc = new MyFlowDocument();
8487
flowDoc.AddChild(child);
8588

86-
flowDoc.RichTextBlock.SetValue(Grid.ColumnProperty, 1);
89+
flowDoc.RichTextBlock.SetValue(Grid.ColumnProperty, 2);
8790
flowDoc.RichTextBlock.Padding = new Thickness(0);
8891
flowDoc.RichTextBlock.VerticalAlignment = VerticalAlignment.Top;
8992
grid.Children.Add(flowDoc.RichTextBlock);

components/MarkdownTextBlock/src/TextElements/MyThematicBreak.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ public MyThematicBreak(ThematicBreakBlock thematicBreakBlock)
2222
_paragraph = new Paragraph();
2323

2424
var inlineUIContainer = new InlineUIContainer();
25-
var border = new Border();
26-
border.Width = 500;
27-
border.BorderThickness = new Thickness(1);
28-
border.Margin = new Thickness(0, 4, 0, 4);
29-
border.BorderBrush = new SolidColorBrush(Colors.Gray);
30-
border.Height = 1;
31-
border.HorizontalAlignment = HorizontalAlignment.Stretch;
32-
inlineUIContainer.Child = border;
25+
Line line = new Line
26+
{
27+
Stretch = Stretch.Fill,
28+
Stroke = new SolidColorBrush(Colors.Gray),
29+
X2 = 1,
30+
Margin = new Thickness(0, 12, 0, 12)
31+
};
32+
inlineUIContainer.Child = line;
3333
_paragraph.Inlines.Add(inlineUIContainer);
3434
}
3535

0 commit comments

Comments
 (0)