1

我在我的应用程序中使用 ExtendedListView,因为我需要池来刷新选项。

我已经通过安装 nuget 包安装了 ExtendedListview 0.0.5.5:Install-Package ExtendedListview

现在我还想在我的列表视图中有一个粘性标题。

所以我可以通过下面的代码在简单列表视图中做到这一点。

<ListView IsHoldingEnabled="True"
    ItemsSource="{Binding Source={StaticResource AddressGroups}}"
    ItemTemplate="{StaticResource AddrBookItemTemplate}"
    ContinuumNavigationTransitionInfo.ExitElementContainer="True">
    <ListView.GroupStyle>
        <GroupStyle HidesIfEmpty="True" HeaderTemplate="{StaticResource AddrBookGroupHeaderTemplate}"/>
    </ListView.GroupStyle>
</ListView>

但同样的事情在 ExtendedListView 中不起作用。

<ctrl:ExtendedListView IsHoldingEnabled="True"
        ItemsSource="{Binding Source={StaticResource AddressGroups}}"
        ItemTemplate="{StaticResource AddrBookItemTemplate}"
        ContinuumNavigationTransitionInfo.ExitElementContainer="True"  >
    <ctrl:ExtendedListView.GroupStyle>
        <GroupStyle HeaderTemplate="{StaticResource AddrBookGroupHeaderTemplate}" />
    </ctrl:ExtendedListView.GroupStyle>
</ctrl:ExtendedListView>

我在两个代码中都使用了相同的 HeaderTemplate,如下所示:

<DataTemplate x:Key="AddrBookGroupHeaderTemplate">
    <Border Background="Transparent" Padding="5">
        <Border Background="Red" BorderBrush="Red" BorderThickness="2" Width="80" 
                Height="62" Margin="0,0,18,0" HorizontalAlignment="Left">
            <TextBlock Text="{Binding Key}" Foreground="White" FontSize="48" Padding="6" 
                        HorizontalAlignment="Left" VerticalAlignment="Center"/>
        </Border>
    </Border>
</DataTemplate>

请尽快指导我。

提前致谢。

4

0 回答 0