ListView项目被隐藏

时间:2015-02-27 15:09:38

标签: xaml windows-phone-8.1

我有ListView分组项目,当我滚动到页面底部时,某些项目就会消失。它看起来只有当HeaderTemplate的某些部分仍然在屏幕上可见时才会发生,因为如果我只看到项目(当我放置更多项目时),那么它绝对没问题。 enter image description here 示例:http://1drv.ms/1ARgNre

项目集合

<CollectionViewSource
     x:Name="Groups"
     IsSourceGrouped="True"
     ItemsPath="Items"
     Source="{Binding Groups}" />

HeaderTemplate中

<ListView.HeaderTemplate>
    <DataTemplate>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>

            <TextBlock
                Foreground="Black"
                FontSize="40"
                Text="Title" />

            <Rectangle
                Grid.Row="1"
                Fill="Gray"
                Height="500" />

            <TextBlock
                Grid.Row="1"
                FontSize="20"
                Foreground="White"
                HorizontalAlignment="Center"
                Text="Sample text in header template"
                VerticalAlignment="Center" />
        </Grid>
    </DataTemplate>
</ListView.HeaderTemplate>

GroupStyle

<ListView.GroupStyle>
    <GroupStyle>
        <GroupStyle.HeaderTemplate>
            <DataTemplate>
                <TextBlock  
                    Foreground="Black"
                    Text="{Binding Title}" />
            </DataTemplate>
        </GroupStyle.HeaderTemplate>
    </GroupStyle>
</ListView.GroupStyle>

的ItemTemplate

<ListView.ItemTemplate>
    <DataTemplate>
        <Grid
            Background="LightGray"
            Height="100"
            Margin="0,12,0,0"
            Width="300">

            <TextBlock
                Foreground="Black"
                Text="{Binding Title}" />

        </Grid>
    </DataTemplate>
</ListView.ItemTemplate>

0 个答案:

没有答案