#1,065 – ViewBox Child Must Have Explicit Size

Whatever content you set as the content wrapped by a ViewBox, that content needs to be able to determine its own size.  The ViewBox needs to know what size to make the content at a scale of 1.0.

If the ViewBox wraps a panel containing elements that can size based on their own content, like buttons, everything works fine.

1065

However, if the ViewBox wraps a Canvas, you need to give the Canvas an explicit size so that the ViewBox knows what size to start with.  If you don’t do this, the ViewBox won’t be able to scale the content within the Canvas.

1065-001

Advertisement