質問

パンニングに使用するWPF ScrollViewer(Mousedown、Mousemove、Mouseup)があり、慣性を組み込んだ加速効果を含めたいと思います。したがって、マウスがしきい値を超えて移動し、マウスを放出すると、パンを続けますが、初期速度の関数として減速します。何かアイデア、考え、例はありますか?

役に立ちましたか?

解決

I've done basically this before and started by looking at ScrollViewer but in the end threw it away and used a Viewbox with a Canvas as the child for absolute positioning of content (I was supporting zoom aswel as scroll, it was basically DeepZoom without the scaled images for zooming so there was pixelation when zoomed right in). I wrote code for determining the gesture direction and the speed of the gesture from the mouse events and converted this to a scroll direction and speed and then animated the Canvas.Left and Canvas.Top properties of the scrollable content (which was in the Children collection of the Viewbox's child Canvas) with DoubleAnimation. It worked well, however there may be a better way...heres a thread suggesting hosting DeepZoom in WPF via a Frame control (although I wouldn't do it that way).

EDIT: Basically the ScrollViewer was just too restricting. Even if you get into the ControlTemplate and get references to the ScrollBars directly, it is the position of the Thumb of these scrollbars that you would need to animate and I'm pretty sure this is what I found I couldn't do (it was almost 3 years ago :)

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top