【发布时间】:2014-11-14 16:28:00
【问题描述】:
我的 DataGrid 又出现问题了……这次:我如何在编辑单元格时关闭排序?
例如:
我最后添加了标记的“A”,它跳到顶部,因为该列已排序。但它应该留在按钮上。如果您对设置文件(在 Visual Studio 中)进行排序,它的工作方式与我想要的完全一样。你可以自己尝试一下,这里是VS中的同一个例子:
我尝试重置SortDirection,不起作用:
private void dgVATINS_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
{
foreach (DataGridColumn col in dgVATINS.Columns)
{
col.SortDirection = null;
}
}
【问题讨论】:
-
这适用于 DataGridView(Windows 窗体)而不是 WPF 中的 DataGrid
-
@reggaeguitar 他的意思是你建议的链接是关于 Winforms,但他正在使用 WPF DataGrid。
标签: c# wpf sorting datagrid sortdirection