开发者

WPF ListView Paging Animation

I have a ListView which contains a grid view (so have multiple columns). I have removed the scroll bars and added paging buttons. What I am looking for is to apply开发者_Python百科 an animation to the data when the user clicks up/down. More specifically I want to apply a scale animation so that it looks like each row got flipped with new data showing (i.e similar to rollodex but for each row).

For paging I am using the VirtualizingStackPanel.PageUp/PageDown calls which works correctly but I have no idea how to apply an animation to the changes.

I tried using the enter/exit actions on a trigger for "IsHitTestVisible" for a ListViewItem but that does not seem to work correctly.

Has anybody done something like this before? Any help appreciated. Thanks.


That is a very complex question with a very complex solution. Here is the basic approach that I would take, assuming that there is some type of observable collection as the ItemsSource of the listview.

  1. Get your next set of data.
  2. For every item in your new data, determine what item it is going to replace in your list view.
  3. Begin an animation to transition out your old item.
  4. When the old item is no longer visible, swap it with the new item (say in your collection) and begin the animation that transitions it in.
  5. Done

Obviously this is a simple approach. What you are describing is a very complex process, and you will likely run into all kinds of edge cases and unexpected behaviour as you go. For example, what to do when the initial list is empty, or your new data has more or less entries than the old data. Good luck!


One more way to do it.. 1. Use TabControl 2. Load all items and spread into tabs based on viewable screen area(or based any of your conditions) 3. Show only only 1 tab at a time 4. upon page up or down show next or previous page and hide the current page 5. Implement your animation upon tab visible

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜