winform中没有找到排序时,会激发的事件。 我不知道楼主要做什么,不知道下面的代码对你是否有用: 在鼠标按到排序headerColumn时屏蔽排序功能; private void dataGrid1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { System.Windows.Forms.DataGrid.HitTestInfo myHitTest; // Use the DataGrid control's HitTest method with the x and y properties. myHitTest = dataGrid1.HitTest(e.X,e.Y); if(myHitTest.Type.ToString().Trim() == "ColumnHeader") this.dataGrid1.AllowSorting = false; //you can add other code if you want }其实你要使不具备排序功能或是是他有排序功能你指定allowsorting即可;
void MyDataGrid_Sort(Object sender, DataGridSortCommandEventArgs e) {
SortField = (string)e.SortExpression;
//BindGrid();
}
我不知道楼主要做什么,不知道下面的代码对你是否有用:
在鼠标按到排序headerColumn时屏蔽排序功能;
private void dataGrid1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
System.Windows.Forms.DataGrid.HitTestInfo myHitTest;
// Use the DataGrid control's HitTest method with the x and y properties.
myHitTest = dataGrid1.HitTest(e.X,e.Y);
if(myHitTest.Type.ToString().Trim() == "ColumnHeader") this.dataGrid1.AllowSorting = false;
//you can add other code if you want
}其实你要使不具备排序功能或是是他有排序功能你指定allowsorting即可;