Skip to content

Commit fe76311

Browse files
Merge pull request #3571 from syncfusion-content/markdown-viewer-ug
968298 : Include Notes to .NET MAUI Markdown Viewer UG Document
2 parents 4a1df6e + efb56fe commit fe76311

File tree

1 file changed

+42
-37
lines changed

1 file changed

+42
-37
lines changed

MAUI/MarkdownViewer/OverridingDefaultStyles.md

Lines changed: 42 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -17,42 +17,45 @@ This guide explains how to override the default styles using the [MarkdownStyleS
1717

1818
{% highlight xaml %}
1919

20-
<ResourceDictionary>
21-
22-
<x:String x:Key="CustomStyle">
23-
body {
24-
background: #FFFBFE;
25-
font-family: 'Roboto', sans-serif;
26-
}
27-
28-
h1 {
29-
font-family: 'Roboto', sans-serif;
30-
font-weight: 700;
31-
font-size: 28px;
32-
line-height: 36px;
33-
letter-spacing: 0px;
34-
color: #1C1B1F;
35-
}
36-
37-
h2 {
38-
font-family: 'Roboto', sans-serif;
39-
font-weight: 700;
40-
font-size: 24px;
41-
line-height: 32px;
42-
letter-spacing: 0px;
43-
color: #1C1B1F;
44-
}
45-
46-
h3 {
47-
font-family: 'Roboto', sans-serif;
48-
font-weight: 600;
49-
font-size: 22px;
50-
line-height: 28px;
51-
letter-spacing: 0px;
52-
color: #1C1B1F;
53-
}
54-
</x:String>
55-
</ResourceDictionary>
20+
<ContentPage.Resources>
21+
22+
<ResourceDictionary>
23+
<x:String x:Key="CustomStyle">
24+
body {
25+
background: #FFFBFE;
26+
font-family: 'Roboto', sans-serif;
27+
}
28+
29+
h1 {
30+
font-family: 'Roboto', sans-serif;
31+
font-weight: 700;
32+
font-size: 28px;
33+
line-height: 36px;
34+
letter-spacing: 0px;
35+
color: #1C1B1F;
36+
}
37+
38+
h2 {
39+
font-family: 'Roboto', sans-serif;
40+
font-weight: 700;
41+
font-size: 24px;
42+
line-height: 32px;
43+
letter-spacing: 0px;
44+
color: #1C1B1F;
45+
}
46+
47+
h3 {
48+
font-family: 'Roboto', sans-serif;
49+
font-weight: 600;
50+
font-size: 22px;
51+
line-height: 28px;
52+
letter-spacing: 0px;
53+
color: #1C1B1F;
54+
}
55+
</x:String>
56+
</ResourceDictionary>
57+
58+
</ContentPage.Resources>
5659

5760
{% endhighlight %}
5861

@@ -62,7 +65,7 @@ This guide explains how to override the default styles using the [MarkdownStyleS
6265
. . .
6366
xmlns:markdown="clr-namespace:Syncfusion.Maui.MarkdownViewer;
6467
assembly=Syncfusion.Maui.MarkdownViewer">
65-
68+
. . .
6669
<markdown:SfMarkdownViewer Source={Binding MarkdownContent}>
6770
<markdown:SfMarkdownViewer.Settings>
6871
<markdown:MarkdownStyleSettings CssStyleRules="{StaticResource CustomStyle}" />
@@ -74,3 +77,5 @@ This guide explains how to override the default styles using the [MarkdownStyleS
7477
{% endhighlight %}
7578

7679
By defining custom styles, you can transform the Markdown viewer into a fully branded and polished content surface that fits seamlessly into your app’s design system.
80+
81+
N> Apply CSS styles only when necessary as they will override the properties of individual Markdown elements such as `H1FontSize`, `H1Color`, `BodyTextColor`, `TableHeaderFontSize`, etc., defined in the [MarkdownStyleSettings]() class.

0 commit comments

Comments
 (0)