在WPF的ListView部分显示的项目恼人的自动滚屏 [英] Annoying auto scroll of partially displayed items in WPF ListView
本文介绍了在WPF的ListView部分显示的项目恼人的自动滚屏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在的ListView WPF ,则如果将项目部分显示我的问题,我点击项目,列表会自动滚动,整个项目将可见的。
I have a ListView in WPF, my problem is if an item is partially displayed and I click on item, the list will automatically scroll so the whole item will be visible.
如何禁用此自动滚动功能?
感谢您
推荐答案
有同样的问题,我已经找到了一个sulotion:)
had the same problem and i've found a sulotion :)
在XAML中定义的样式与此EventSetter的ListViewItem的:
in the Xaml you define a style for the ListViewItem with this EventSetter:
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}">
<EventSetter Event="RequestBringIntoView" Handler="ProjectListView_OnRequestBringIntoView"/>
</Style>
</ListView.ItemContainerStyle>
在code背后:
private void ProjectListView_OnRequestBringIntoView(object sender, RequestBringIntoViewEventArgs e)
{
e.Handled = true;
}
希望这会为你工作了:)
Hope this will work for you too :)
这篇关于在WPF的ListView部分显示的项目恼人的自动滚屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文