WP 8.1 bottom to top infinite scrolling

情到浓时终转凉″ 提交于 2019-12-09 03:39:08

问题


I have explored ISupportIncrementalLoading and seen MS sample and other examples for infinite scrolling behaviour.

But I want bottom to top scrolling where items are added on top on scrolling bottom to top.

Edit:I have found a workaround for this. I have rotated listview by 180 degree and datatemplate by 180 degree which helped me achieve desired functionality.

 <ListView x:Name="GridViewMain" IncrementalLoadingThreshold="2" RenderTransformOrigin="0.5,0.5">
        <ListView.RenderTransform>
            <RotateTransform Angle="180"></RotateTransform>
        </ListView.RenderTransform>
        <ListView.ItemContainerStyle>
            <Style TargetType="ListViewItem">
                <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                <Setter Property="VerticalContentAlignment" Value="Stretch"/>
            </Style>
        </ListView.ItemContainerStyle>
        <ListView.Resources>
            <DataTemplate x:Key="DataTemplateGridViewMain">
                <Grid HorizontalAlignment="Stretch" Background="#FF7C1A9B" RenderTransformOrigin="0.5,0.5">
                    <Grid.RenderTransform>
                        <RotateTransform Angle="180"/>
                    </Grid.RenderTransform>
                    <TextBlock HorizontalAlignment="Left" Text="{Binding}" VerticalAlignment="Center" FontSize="20" FontFamily="Tempus Sans ITC" />
                </Grid>
            </DataTemplate>
        </ListView.Resources>
        <ListView.ItemTemplate>
            <StaticResource ResourceKey="DataTemplateGridViewMain" />
        </ListView.ItemTemplate>
    </ListView>

Is this solution has any perf impact or is there any alternate way to do this?


回答1:


not sure if this will fit your needs, but I had to do something similar when creating a chat conversation screen, and was able to achieve this using ExtendedListView: https://www.nuget.org/packages/ExtendedListView

We load the most recent items, and use ScrollIntoView(lastMessage) to position the cursor at the bottom. Normally you would use MoreDataRequested event to get items when it scrolls to the bottom, but instead we reversed it and used the PullToRefreshRequested to simulate scrolling to the top, changing the loading template to say "loading more messages".

works pretty well for us, I hope this is helpful!



来源:https://stackoverflow.com/questions/29764868/wp-8-1-bottom-to-top-infinite-scrolling

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!