Hi I am quite new to XAML and I just can't figure how to do create this layout.
So imagine a layout with a header, main area and footer. Each region is simply an image control.
I am using a grid definition of:
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
So all the empty space is used up by the main area. This is great for portrait windows but however when the window is resized to be landscape. The footer and header eats up all the space and there is hardly any left for the main area and infact I can't see the image for the main area as there is no space left.
So is it possible to specify a minimum height for the main area? I tried using MinHeight to the image control in the main area but it make no difference. I am hoping by specifying a minimum height, this will force the header and footer regions to be smaller and hence those images will scale to maintain aspect ratios and hence their widths will also become smaller. Hope that makes sense.
Any ideas?
When you specify * as your Height or Width for rows or columns respectively you tell them to take % left after the other calculations. If you have two columns with * as Width than they take 50% of the left space each.
When you specify Auto it's taking into account the size of the controls inside.
There is property MinHeight for row and column definitions
So you could try to set MinHeight of the main row but I think it may not work, and you could also specify the size of the elements in the header and the footer rows to be of certain size (you could do that only on landscape mode and leave it as is in portrait)
Edit - added links for reference
GridLength Structure
GridUnitType Enumeration
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With