*** Sent via Developersdex http://www.developersdex.com ***
Best regards,
Sergey Bogdanov
http://www.sergeybogdanov.com
private void dataGrid1_MouseUp(object sender, MouseEventArgs e)
{
DataGrid myGrid=(DataGrid)sender;
DataGrid.HitTestInfo myHitInfo = myGrid.HitTest(e.X,e.Y);
if(myHitInfo.Type == DataGrid.HitTestType.ColumnResize)
{
//Do Nothing
}
}
Hope this helps,
Cheers,
Arun.
www.innasite.com
public class DataGridWithFixedColumnWidth : DataGrid
{
protected override void OnMouseDown(MouseEventArgs e)
{
DataGrid.HitTestInfo hitInfo = HitTest(e.X, e.Y);
// suppress ColumnResize event
if (hitInfo.Type == DataGrid.HitTestType.ColumnResize) return;
base.OnMouseDown (e);
}
}
Best regards,
Sergey Bogdanov
http://www.sergeybogdanov.com
Thankx guys, I'll try both solutions..
a question about HitTestInfo :
can i use this property to disallow a user to select a row in a datagrid
?
here's the problem:
In a datagrid that is used only in view mode,I don't want the user to be
able to change the row selections. For this purpose, I disabled the
datagrid, but the disadvantage of this method is that it prevents the
user to scroll the datagrid, and thus can't see all the records.
regards
DataGrid.HitTestType.Cell
DataGrid.HitTestType.Caption
DataGrid.HitTestType.ColumnHeader
DataGrid.HitTestType.ColumnResize
DataGrid.HitTestType.ParentRows
DataGrid.HitTestType.RowHeader
DataGrid.HitTestType.RowResize
DataGrid.HitTestType.None
block all the HitTestType each with separate condition
I didn't know that HitTestType can be that useful.
that's great :)