Windows phone 8 将ScrollViewer.OperationMode设置为System不会';好像不行
我使用ListBox实现了一个层次结构树。我通过握住一个项目并拖动它来实现项目重新排序方法 为此,我截取项目的Hold、操纵增量和操纵完成事件。因为Listbox的ScrollViewer默认处于操纵模式=操纵模式.System,所以我需要将其设置为操纵模式.Control以临时禁用它,以便能够拖动我的项目 如果我不这样做,scrollviewer会拦截我的操纵增量事件,因此当用户尝试拖动项目时,他会滚动scrollviewer,而我的项目会保持在固定位置 通常,在用户删除该项后,我希望将其设置回操纵模式.System(如果我不这样做,则树结构滚动仍然很慢,因为该项的模板有点重/复杂) 我读过,在调用ApplyTemplate()之后,我无法切换操作模式,但我也读到,如果通过设置via dependency属性而不是standard属性来实现,则应该可以切换操作模式Windows phone 8 将ScrollViewer.OperationMode设置为System不会';好像不行,windows-phone-8,windows-phone,scrollviewer,Windows Phone 8,Windows Phone,Scrollviewer,我使用ListBox实现了一个层次结构树。我通过握住一个项目并拖动它来实现项目重新排序方法 为此,我截取项目的Hold、操纵增量和操纵完成事件。因为Listbox的ScrollViewer默认处于操纵模式=操纵模式.System,所以我需要将其设置为操纵模式.Control以临时禁用它,以便能够拖动我的项目 如果我不这样做,scrollviewer会拦截我的操纵增量事件,因此当用户尝试拖动项目时,他会滚动scrollviewer,而我的项目会保持在固定位置 通常,在用户删除该项后,我希望将其设置
我做错了什么?是否无法返回到系统模式?如果我转到另一个页面并返回到此页面,scrollViewer仍然会滞后。只有应用程序重新启动才能工作。只需将UseOptimizedManipulationRouting=“False”设置为拖动项控件,以防止将事件路由到scrollviewer
private void ElementHold(object sender, GestureEventArgs e) {
....
_scrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled;
_scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Disabled;
// works ok
_scrollViewer.SetValue(ScrollViewer.ManipulationModeProperty, ManipulationMode.Control);
}
private void ElementManipulationCompleted(object sender, ManipulationCompletedEventArgs e) {
_scrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
_scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
// ▼ this doesn't seem to work.
// ▼ In the debugger ManipulationMode has correct value but scrolling
// ▼ still lags which means that scrollviewer stays in Control mode.
_scrollViewer.SetValue(ScrollViewer.ManipulationModeProperty, ManipulationMode.System);
}