iPhone就像在Silverlight ListBox上滚动一样

问题描述:

我需要一个具有类似于iPhone功能的Silverlight列表框.即,动画滚动,然后单击并拖动以滚动.根据拖动的速度",在鼠标上移事件之后,滚动将继续进行一点.我已经搜索过,没有找到提供此功能的控制供应商.那么问题是我应该如何建造呢?我需要一些提示以开始使用.

I need a listbox with IPhone-like functionality for Silverlight. That is, animated scrolling, and click and drag to scroll. Scrolling will continue a bit after the mouse up event based on the "speed" of the dragging. I've search and found no control vendors providing this. So question is how should I build it? I need some hints to get started.

这个问题有两个部分:

第1部分,如何获得列表框的动画滚动.

Part 1, How to get the animated scrolling of the listbox.

第2部分,如何构建可拖动"滚动,我想我应该将画布放在顶部并跟踪mouseevent,并模拟一些物理过程.这里有些提示会很棒.

Part 2, How to build a "draggable" scrolling, I guess I should put a canvas on top and track the mouseevent, and simulate some physics. Some hints here would have been great.

感谢Larsi.

前一阵子,我做了一个控件,它做了这样的事情.我所做的只是在画布上放了一块栈板.只需在mousemove(按住鼠标)上调整整个堆栈面板的canvas.top.要使鼠标悬停后的滚动动画,您只需要跟踪移动的数量并将动画应用于canvas.top属性即可.

A while ago I made a control that did something like this. All I did was put a stackpanel inside a canvas. Just adjust the canvas.top of the entire stackpanel on a mousemove (while mouse is pressed). To animate the scrolling after a mouseup, you really just need to track the amount moved and apply an animation to the canvas.top property.