Obiwan007
Obiwan007

Reputation: 646

Winrt Xaml Grid ROw not filling Space with *

I have the problem, that my Grid is not filling the space as I want it. Here some code:

<HubSection>
      <Grid  Width="850">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="35"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="310"/>
                    </Grid.RowDefinitions>
                   <Input:RadDatePicker Grid.Row="0" Value="{Binding CurrentDate, Mode=TwoWay}" />
                   <ListView 
                            Grid.Row="1">...
                   </ListView>
                   <Grid Height="310"
                            Grid.Row="2">...
                   </Grid>

... I want that the middle row is filling the space up of the hubsection. Instead it now just fills up when the listview contains enough items. Any idea?

Screen with a few ListViewItems. Notice the empty bottom

Now the filled ListView: Screen with a filled ListView - Scrollbar is visible. Bottom is filled.

Upvotes: 1

Views: 1255

Answers (1)

Filip Skakun
Filip Skakun

Reputation: 31724

I would try setting the VerticalContentAlignment of the HubSection to Stretch as well as setting the VCA of the outer grid to that option. I'm suspecting the default might be Center or Top and so the minimizing vertical alignment control from the parent control and the expanding star-sized row setting of the inner grid come in a little bit of a conflict that some layout prioritizing rules probably resolve in getting the VCA rule to win.

For similar layout issues it is usually best to analyze with a visual tree debugger such as the XAML Spy or WinRT XAML Toolkit. You can also try tracing these various properties by walking the visual tree with the VisualTreeHelper class yourself.

Upvotes: 4

Related Questions