NeoMarkdigXaml icon indicating copy to clipboard operation
NeoMarkdigXaml copied to clipboard

Custom styling

Open LaurentMinot opened this issue 4 years ago • 5 comments

Hello, Could you detail a bit more on how to have a custom styling? It seems a bit complicatd to achieve.

What I tried (without success):

image

image

image

image

LaurentMinot avatar Jul 13 '20 08:07 LaurentMinot

Ok it was easier that what I thought. No need to use custom classes, just overriding styles works. I think a few notes in readme would be helpful.

LaurentMinot avatar Jul 13 '20 09:07 LaurentMinot

Until now I didn't know to that people use this library.

I will see what I can do!

neolithos avatar Jul 13 '20 22:07 neolithos

@LaurentMinot I'd be curious to know what you did. I just statically referenced the keys with no luck:

<UserControl ...
             xmlns:md="clr-namespace:Neo.Markdig.Xaml;assembly=Neo.Markdig.Xaml"
             ... >
<Style TargetType="{x:Type Paragraph}" x:Key="{x:Static md:MarkdownXaml.Heading1StyleKey}">
    <Setter Property="FontSize" Value="42" />
    <Setter Property="Foreground" Value="Red" />
    <Setter Property="FontWeight" Value="Bold" />
</Style>

<Style TargetType="{x:Type Paragraph}" x:Key="{x:Static md:MarkdownXaml.Heading2StyleKey}">
    <Setter Property="FontSize" Value="20" />
    <Setter Property="Foreground" Value="Red" />
    <Setter Property="FontWeight" Value="Bold" />
</Style>

<Style TargetType="{x:Type Paragraph}" x:Key="{x:Static md:MarkdownXaml.Heading3StyleKey}">
    <Setter Property="FontSize" Value="18" />
    <Setter Property="Foreground" Value="Red" />
    <Setter Property="FontWeight" Value="Bold" />
</Style>

kdelorey avatar Oct 29 '20 22:10 kdelorey

@LaurentMinot I would also be interested to know what you did.

akselkvitberg avatar Mar 24 '21 09:03 akselkvitberg

This will not work, because my styles in MarkdownXaml are bind to an assembly. I change them to internal.

You need to override GetDefaultStyle to return you own resource keys.

If someone has a good idea to make it better. I am open for it.

neolithos avatar Mar 31 '21 15:03 neolithos