2015-09-22 41 views
0

我有一个为触摸显示器构建的全屏WPF应用程序,并且我在主屏幕上有一些ListBox。为WPF触摸应用程序列表框添加惯性

当我弹出Listbox它滚动罚款,但是当它到达列表的末尾,整个应用程序被从屏幕的顶部拉下来,但我只需要惯性为列表框,而不是整个窗口。我如何才能做到这一点?

回答

1

在ManipulationBoundaryFeedback事件使应用程序或 组件来提供视觉反馈当物体撞击的边界。 例如,Window类处理ManipulationBoundaryFeedback事件,以便在遇到边缘为 时使窗口轻微移动。

因此,变通的办法是处理的列表框,并处理已设置为true在ManipulationBoundaryFeedback:

<ListBox ManipulationBoundaryFeedback="OnManipulationBoundaryFeedback">    
    // ... 
</ListBox> 

代码隐藏:

private void OnManipulationBoundaryFeedback(object sender, ManipulationBoundaryFeedbackEventArgs e) 
{ 
    e.Handled = true; 
} 
+0

这将不仅解决了闪烁。 。我需要Listbox进行惯性移动 –

+0

你还实现了'InertiaProcessor Attached Dependency Property'吗? –

+0

no ..如何添加那个?你能帮我补充一点吗? –

相关问题