xaml-math
xaml-math copied to clipboard
Not possible to set default style of FormulaControl in app?
I'm trying to set a default style for FormulaControl in my entire app. At the moment it doesn't work, and I believe it might be related to this SO answer:
https://stackoverflow.com/a/39364416/4351604
If i'm correct, this should be added to FormulaControl.cs
static MyControl()
{
DefaultStyleKeyProperty.OverrideMetadata(
typeof(FormulaControl),
new FrameworkPropertyMetadata(typeof(FormulaControl)));
}
@samirem, could you please elaborate on what are you trying to do?
I've tried to add the code you asked, and now the control doesn't renders at all. From other answers, it looks like we miss the control template, and currently I have no idea what to put into it (because I've never authored my own control before).
Could you please share the proposed usage of the control, i.e. what do you want to customize?
Very late reply, but recently I've stumbled upon the same issue. What I'm trying to do is apply default styles to my FormulaControl's using a keyless Style-tag like the following:
<Style TargetType="{x:Type wpfMath:FormulaControl}">
...
</Style>
However, that does not seem to work, and I suspect that the issue has to do with DefaultStyleKey not being overridden. I will try to see if I can figure out how it should be solved.
Could you please elaborate a bit more? What particular aspect of styling are you trying to change?
(and it's nice to see you after these years, hope you are okay 😅)
Sure! I have lots of FormulaControls in the same app and I want them all to use the same values for SystemTextFontName, TextOptions.TextRenderingMode, TextOptions.TextHintingMode, etc.