WindowsCommunityToolkit icon indicating copy to clipboard operation
WindowsCommunityToolkit copied to clipboard

MarkdownTextBlock Parsing Failed

Open avknaidu opened this issue 9 years ago • 10 comments

While moving the common Properties that i use for MarkdownTextBlock to Page.Resources, I noticed that if I use the Property in Setter for TargetType MarkdowmTextBlock, It throws a Xaml Parsing failed error.

I have also uploaded a sample Here to replicate the problem.

capture

avknaidu avatar Apr 20 '17 17:04 avknaidu

ping @deltakosh

nmetulev avatar Apr 21 '17 02:04 nmetulev

ping @deltakosh @nmetulev I dug a few more steps and found out it throws an error Key/Name Not found when i set a style to MarkdownTextBlock.

avknaidu avatar Apr 24 '17 14:04 avknaidu

Thanks a lot @avknaidu I'll check it tomorrow

deltakosh avatar Apr 25 '17 04:04 deltakosh

Sorry I'm a bit swamped out in Build preparation. Will get back to you this thursday Sorry for the delay

deltakosh avatar Apr 25 '17 17:04 deltakosh

@deltakosh no problem. Can you point me to where this issue can be? I always worked on Using and Reusing Controls but never worked on creating new controls. If you can point me where to start by a quick guess, maybe i can debug through and find a fix myself. If i find it, I will make sure I post it here. This is not a show stopper for me, but i can make this into a learning experience for myself.

avknaidu avatar Apr 25 '17 18:04 avknaidu

Did you check that the name space is well defined in you app.xaml?

If it was working in page I think more about a typo or something along this line

deltakosh avatar Apr 25 '17 18:04 deltakosh

Ok. I narrowed it down to ImageStretch Property. if i have this property in Style under Page.Resources, It throws exception. If i remove it, it works fine. Also This is not the only dependancy property that I used in style. I have LinkForeground and it still works perfectly fine.

avknaidu avatar Apr 25 '17 19:04 avknaidu

I think i fixed the problem.

I looked into the Dependency Property Itself and noticed that name of ImageStretchProperty is IsTextSelectionEnabled

public static readonly DependencyProperty ImageStretchProperty = DependencyProperty.Register(
        nameof(IsTextSelectionEnabled),
        typeof(Stretch),
        typeof(MarkdownTextBlock),
        new PropertyMetadata(Stretch.None, OnPropertyChangedStatic));

I changed this to ImageStretch and it works fine.

avknaidu avatar Apr 25 '17 19:04 avknaidu

Good catch:) fancy doing a PR?

deltakosh avatar Apr 25 '17 19:04 deltakosh

Sure.

avknaidu avatar Apr 25 '17 19:04 avknaidu