开发者

Manipulation events in a ListBox in wpf4 is never raised

I have a ListBox control defined within MainWindow and its IsManipulationEnabled property is set to true. I have the manipulation events (OnManipulationStarting, OnManipulationInertiaStarting and OnManipulationDelta) defined in the MainWindow. The goal here is to achieve a translation on the Listbox control, more like a flip functionality.

Howev开发者_如何学JAVAer, these events are never raised. I am assuming that the selection events are in turn gobbling these events. When I use itemscontrol instead, it works fine. But the problem in using itemscontrol is that I do not get a selection state. Another option would be to work on raw touch, but manipulations are way easier.

Why do the Manipulation events not fire on Listbox?

Thanks in advance!


The default template for an ItemsControl doesn't contain a ScrollViewer but the ListBox does. The ScrollViewer handles those events when the PanningMode is something other than None. By default a ScrollViewer binds several of its properties (like PanningMode) to that of its templated parent. Try setting the attached ScrollViewer.PanningMode property to None on the ListBox.

<ListBox ScrollViewer.PanningMode="None" />
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜