Alexandr Sulimov
Alexandr Sulimov

Reputation: 1924

XAML (WP8.1) scrollable ListView and fixed Grid bottom of DataTemplate

<DataTemplate>
    <ScrollViewer>
        <Grid>
            ... same rows and controls 20% of screen
        </Grid>
        <ListView>
        </ListView>
    </ScrollViewer>
</DataTemplate>

With this template there are

  1. fixed Grid first

  2. scrollable ListView second

How create template with

  1. scrollable ListView at top

  2. fixed Grid at bottom

?

P.S. There are online or compiled demo different xaml layout/templates?

Upvotes: 1

Views: 442

Answers (1)

Kristian Vukusic
Kristian Vukusic

Reputation: 3324

Don't put a ListView inside a ScrollViewer because you will lose virtualization if you are using it, which will degrade performance significantly.

If you want the Grid to always be visible then use the following:

<DataTemplate>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <ListView Grid.Row="0"/>
        <Grid Grid.Row="1" Height="100"/> <!-- Set any fixed height -->
    </Grid>
</DataTemplate>

If you want the Grid to scroll with the list use a Footer:

<DataTemplate>
    <ListView>
        <ListView.Footer>
            <!-- Set any fixed height -->
            <Grid Height="100"/>
        </ListView.Footer>
    </ListView>
</DataTemplate>

Upvotes: 1

Related Questions