iPhone 喜欢在 Silverlight ListBox 上滚动 [英] IPhone like scrolling on Silverlight ListBox

查看:10
本文介绍了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 部分,如何构建可拖动"滚动,我想我应该在顶部放置一个画布并跟踪鼠标事件,并模拟一些物理.这里的一些提示会很棒.

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.

谢谢拉尔西.

推荐答案

前段时间我做了一个类似这样的控件.我所做的只是在画布内放置一个堆栈面板.只需在鼠标移动(按下鼠标时)上调整整个堆栈面板的 canvas.top.要在 mouseup 后为滚动设置动画,您实际上只需要跟踪移动量并将动画应用于 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.

这篇关于iPhone 喜欢在 Silverlight ListBox 上滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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