This project is read-only.

Viewbox scaling broken in ModernWindow

Oct 14, 2013 at 8:18 PM

I'm using a ModernTab within a ModernWindow. The content area has a Viewbox with a fixed size and Stretch="Uniform". The content is ~1/2 the size of the Viewbox, and it does not scale as expected. The content looks like it's being stretched within MS Paint, defeating the purpose of the Viewbox.

I've tested the exact same xaml within an empty Window dialog (note: not ModernWindow) and it works exactly as expected.

I've resorted to creating a custom Viewbox that disables style inheritance:
this.InheritanceBehavior = System.Windows.InheritanceBehavior.SkipAllNow;
So there has to be a property in the MUI source that I cannot find, that is causing this behavior in the Viewbox.

As I mentioned, I have a solution I can move forward with; however, I would very much like to know what the root cause is.

I had to post this in a hurry, so if you'd like additional code/screenshots, I can edit this later.

Oct 14, 2013 at 10:14 PM
Does the Viewbox content happen to be a TextBlock? If so, see this post on StackOverflow for an explanation what happens ->

Setting the TextOptions.TextFormattingMode attached property to Ideal will address the issue.
Marked as answer by kadolphc on 10/14/2013 at 3:16 PM
Oct 14, 2013 at 11:02 PM
And here I thought I searched everything under the sun to diagnose this. Yes this was the issue, and it was happening to Labels as well; though, it doesn't explain why everything rendered w/o issue on a Window that's isolated from the M:UI styles.

Anyway, thank you for your prompt response.