Hi
pls try this method also.I added a event handler to the DataGridColumnStyle.WidthChanged. and reset the width to prefered value.
refer the attached sample for more details
>tried the code for preventing column resize and it does not work.still able to grab the column in the column header and resize the datagrid.
>am i missing something?
>
>5.44 How can I prevent my user from sizing columns in my datagrid?
>
>You can do this by subclassing your grid and overriding OnMouseMove, and not calling the baseclass if the point is on the columnsizing border.
>
>[C#]
>
>public class MyDataGrid : DataGrid
>
>{
>
> protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e)
>
> {
>
> DataGrid.HitTestInfo hti = this.HitTest(new Point(e.X, e.Y));
>
> if(hti.Type == DataGrid.HitTestType.ColumnResize)
>
> {
>
> return; //no baseclass call
>
> }
>
> base.OnMouseMove(e);
>
> }
>
>}
>
>
>
datagrid3.zip