How to show LongListSelector's items in reverse order?

264 views Asked by At

My purpose is to show a collection of items in reverse order in LongListSelector. I don't want to reverse the collection in code behind using a Reverse() method (because newly added items won't show correctly...? )

But it seems I should use CollectionViewSource. the problem is: how to use it?!

<phone:LongListSelector>
    <phone:LongListSelector.ItemTemplate>
        <DataTemplate>
            <StackPanel>
                <TextBlock Text="{Binding BookTitle}" FontSize="{StaticResource PhoneFontSizeMedium}"/>
                <TextBlock Text="{Binding BookAuthor}" FontSize="{StaticResource PhoneFontSizeMedium}"/>
            </StackPanel>
        </DataTemplate>
    </phone:LongListSelector.ItemTemplate>
</phone:LongListSelector>

Is it possible?

1

There are 1 answers

0
Carmelo La Monica On

you can implement code from the ItemSource property of the control LongListSelector and add the method Reverse () after the sample collection

LongListSelector.ItemSource tuaCollection.Reverse = ();