wpf datagrid中的排序和滚动问题 [英] Sorting and Scrolling problem in wpf datagrid
本文介绍了wpf datagrid中的排序和滚动问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的wpf应用程序中,当我的滚动向上时,数据网格排序工作得很好
但是当我按下我的滚动时,我的排序不起作用直到它到达顶部。
In my wpf application datagrid sorting works perfectly when my scroll is up
but when i down my scroll my sorting not works till it comes the top .
推荐答案
由于拖放数据网格项目,我遇到了这个问题
我在PreviewMouseLeftButtonDown中添加了以下代码,并在数据网格中添加了Drop事件
DataGrid grd = e.Source as DataGrid;
if(grd == null)
return;
//确保选中网格下的行
点位置= e.GetPosition(grd);
var row = UIHelpers.TryFindFromPoint(grd ,position);
if(row == null)return;
I was facing this issue because of drag and drop datagrid items
I added following code in PreviewMouseLeftButtonDown and Drop events of datagrid
DataGrid grd = e.Source as DataGrid;
if (grd == null)
return;
//make sure the row under the grid is being selected
Point position = e.GetPosition(grd);
var row = UIHelpers.TryFindFromPoint(grd, position);
if (row == null) return;
这篇关于wpf datagrid中的排序和滚动问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文