通过itens的重新排序的ListView WPF动画? [英] WPF ListView animation by reorder of itens?

查看:116
本文介绍了通过itens的重新排序的ListView WPF动画?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要做的事几年前我一个WPF中看到的演示。我不知道它是怎么做,但我知道这是可以做到这样是我的问题。

I want to do something I saw during a WPF demo some years ago. I don't know how it was done but I know it can be done so that is my problem.

在演示中有一个与一个ListView或ListBox中有很多项的WPF应用程序。每次在ListView被重新排序的项目列表中的换了个地方。但在ListView并不只是刷新其实有项目的移动到新位置的动画。

In the demo there was an WPF application with a ListView or ListBox with a lot of items. Every the ListView was reordered the items changed places in the list. But the ListView was not just refreshed in fact there was an animation of the items moving to their new positions.

这是应用非常冷静和现在这正是我需要的。我们计划做一个实时的数据排名,应用程序和这种动画将是完美的。

This application was very cool and right now this is exactly what I need. We plan to do a live-data-ranking-apps and this kind of animation would be perfect.

但没有人在我的团队有一个想法如何可以做到这一点。我想到的是一个ObservableCollection和数据绑定,但其余的是一个总的谜给我。

But no one in my team has an idea how this can be done. I am thinking of an ObservableCollection and Databinding but the rest is a total mystery to me.

任何提示或想法将是一个很大的帮助。我肯定有人已经这样做了。我用我自己的眼睛看到它时,WPF是新的,但我不知道从哪里开始寻找。

Any hint or idea would be a great help. I am sure someone has done that already. I saw it with my own eyes when WPF was new but I have no idea where to start looking.

推荐答案

有也是做自定义面板的可能性。查理是pretty有关覆盖布局多的权利。要创建自定义面板,你主要是要覆盖从继承了的MeasureOverride ArrangeOverride 方法System.Windows.Controls.Panel

There is also the possibility of doing a custom Panel. Charlie is pretty much right about overriding layout. To create a custom Panel, you primarily have to override the MeasureOverride and ArrangeOverride methods inherited from System.Windows.Controls.Panel.

这个项目上$ C $的CProject 说明了两个自定义面板中,你可以学习如何制作动画。在 FanPanel 动画项目的重新定位,当一个人从一个行的结尾移动到另一个或反之亦然开始。

This project on CodeProject demonstrates a couple custom panels in which you could study how they animated. The FanPanel animates the repositioning of items when one moves from the end of one row to the beginning of another or vice-versa.

本教程还演示动画开始在 ArrangeOverride

我还没有尝试过,但你还可以沿着使用排名值与自定义的 ValueConverter 来的等级转换到一个位置,以驱动一个画布中这样的动画。自定义面板会更好自成体系,不过,允许您更改使用你的排名数据的DataTemplate 键,让每个那些告诉面板他们想要多高待(假设他们是垂直排列)。

I haven't tried it, but you may also be able to use the rank value along with a custom ValueConverter to convert the rank to a position in order to drive such an animation within a Canvas. A custom panel would be better self-contained, though, allowing you to change the DataTemplate used on your ranked data and let each of those tell the Panel how tall they want to be (assuming they're arranged vertically).

这篇关于通过itens的重新排序的ListView WPF动画?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆