Ryan Archibald
Ryan Archibald

Reputation: 215

Grid row height

I am trying to increase the height of a row in my grid to the number of items I add in XAML, I'll draw it out to explain and hopefully someone can help me with my problem:

enter image description here

Upvotes: 0

Views: 136

Answers (1)

Markus
Markus

Reputation: 3375

How about:

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="43"/>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="54"/>
    </Grid.RowDefinitions>
    <Button Grid.Row="0" Content="Title"/>
    <StackPanel Grid.Row="1" Orientation="Vertical">
        <TextBlock Text="Scenario 1" />
        <TextBlock Text="Scenario 2" />
        <TextBlock Text="Scenario 3" />
    </StackPanel>
    <Button Grid.Row="2" Content="Add scenario"/>
</Grid>

This will not grow the window, but just the Grid itself.

Upvotes: 1

Related Questions