Width proportional to the Height

It is possible to create a element (Panel, image, etc) with a exact proportion? Like a Panel that his Width is proportional to the Height in 3:1, by example a Panel that his Widht is 90% his Height will be 30% (of the Widht size not the parent Height)


You can use the BoxSizing="FillAspect" mode. For example:

<Panel Width="90%" Aspect="3" BoxSizing="FillAspsect">

This creates a panel that is 90% the width of its parent and has a 3:1 ratio (aspect is simple X/Y).

The ASpect will be used to fill in the missing dimension, so in the above it will use the Width to determine the Height. If you specify Height then the width will be calculated. If you specify both it’ll be the largest size that fits within both.

Work Perfect! Thanks!