-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MarkdownStyle is being overridden in constructor #34
Comments
To workaround the issue I've created a descendant class and added the public class MarkdownViewer : MarkdownScrollViewer
{
public static readonly DependencyProperty MarkdownStyleFixedProperty =
DependencyProperty.Register(
nameof(MarkdownStyleFixed),
typeof(Style),
typeof(MarkdownViewer),
new PropertyMetadata(null, UpdateMarkdownStyleFixed));
public Style? MarkdownStyleFixed
{
get => (Style)GetValue(MarkdownStyleFixedProperty);
set => SetValue(MarkdownStyleFixedProperty, value);
}
private static void UpdateMarkdownStyleFixed(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var control = (MarkdownScrollViewer)d;
control.MarkdownStyle = (Style)e.NewValue;
}
public override void EndInit()
{
base.EndInit();
if (MarkdownStyleFixed != null && MarkdownStyleFixed != MarkdownStyle)
{
MarkdownStyle = MarkdownStyleFixed;
}
}
} Hope this helps to someone until the original issue is fixed. |
whistyun
added a commit
that referenced
this issue
May 14, 2022
I released v1.15. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is
MarkdownStyle
property inMarkdownScrollViewer
control.It can be set directly, or via a style.
However, setting it via a style does not work, because its value is being overridden by
Standard
Markdown style:The overriding is happening in
MarkdownStyleNameProperty
change handler (UpdateStyleName
method):Please fix the issue.
The text was updated successfully, but these errors were encountered: