【问题标题】:Scrolling issue in LongListSelector with items of variable heightLongListSelector 中具有可变高度的项目的滚动问题
【发布时间】:2013-09-17 20:24:37
【问题描述】:

我有一个LongListSelector,其中每个项目可以包含可变数量的图像,因此可以具有不同的高度。这是我的 XAML:

<phone:LongListSelector x:Name="Views" ItemsSource="{Binding}">
    <phone:LongListSelector.ItemTemplate>
        <DataTemplate>
            <ItemsControl ItemsSource="{Binding Imgs}">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <Border Background="#44AAAAAA" Margin="10,0,10,10">
                                <Image Source="{Binding photo.Source}" Stretch="UniformToFill"
                                    Height="{Binding Converter={StaticResource ScaleHeight}, Path=photo}" />
                            </Border>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
        </DataTemplate>
    </phone:LongListSelector.ItemTemplate>
</phone:LongListSelector>

问题是在滚动这样的LongListSelector 时,当我遇到一个长项目时,滚动位置突然向前/向后跳跃几个项目(取决于滚动方向)。

我怀疑这与虚拟化有关,但我不知道如何解决。有什么建议吗?

【问题讨论】:

    标签: xaml windows-phone-8 scroll virtualization itemscontrol


    【解决方案1】:

    您应该使用带有空标题的 LongListSelector 的 Grouped 版本,这样您就不会拥有高度不同的项目。

    【讨论】:

      猜你喜欢
      • 2014-01-03
      • 1970-01-01
      • 2018-02-12
      • 2020-02-07
      • 2018-03-29
      • 1970-01-01
      • 1970-01-01
      • 2017-09-28
      • 1970-01-01
      相关资源
      最近更新 更多