XAML (WP8.1) 可滚动的 ListView 和 DataTemplate 的固定网格底部

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>

使用此模板有

  1. 首先固定网格

  2. 第二个可滚动ListView

如何使用

创建模板
  1. 顶部的可滚动 ListView

  2. 固定网格在底部

?

P.S。网上有或者编译好的demo不同xamllayout/templates?

不要将 ListView 放在 ScrollViewer 中,因为如果您正在使用它,您将失去虚拟化,这会显着降低性能。

如果您希望 Grid 始终可见,请使用以下内容:

<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>

如果您希望 Grid 随列表滚动,请使用 Footer:

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