public class MyDataGrid : DataGrid
{
protected override void OnMouseDown(MouseEventArgs e)
{
Point pt = new Point(e.X, e.Y);
DataGrid.HitTestInfo hti = this.HitTest(pt);
if(hti.Type == HitTestType.ColumnHeader && hti.Column == 1)
{
//col 1 不排序
return; //don't call baseclass
}
base.OnMouseDown(e);
}
}
参考资料:
http://www.syncfusion.com/FAQ/WindowsForms/FAQ_c44c.aspx