1

I want to arrange two UIControls vertically. The top one is variable height while the bottom one is fixed height. How can I make the top element stretch to available height in a StackPanel or Grid?

My question is similar to this question, and the answer suggested the use of DockPanel, however in WP8 there's no DockPanel, so is there any other alternative of that?

Community
  • 1
  • 1
0xC0DED00D
  • 19,522
  • 20
  • 117
  • 184
  • 1
    You can accomplish this using Grid panel, but not using StackPanel. There is a good article about how to layout UIControls inside a Grid panel [here](http://wpftutorial.net/GridLayout.html) – har07 Jan 02 '14 at 04:19
  • @har07 Thanks for suggesting this. I am going to check this in my project. – 0xC0DED00D Jan 02 '14 at 07:36

1 Answers1

4

A Grid can do that with a row-height of "*" - i.e. a Grid with two rows, the top one "*" the bottom one "auto" would do the trick (not verified for Win8 but should work if memory serves)

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="*"/>
        <RowDefinition Height="auto"/>
    </Grid.RowDefinitions>
    ...
</Grid>
Roman Gruber
  • 1,411
  • 11
  • 16