Hi,
How to prevent user to change column widths ?
I cannot find the relevant property to do it.
I am using the GridControl.
Thanks for your help.
Br,
Jean-Marc
CB
Clay Burch
Syncfusion Team
October 16, 2009 12:51 PM UTC
One way you can do it is the subscribe to this event:
gridControl1.ResizingColumns += new GridResizingColumnsEventHandler(grid_ResizingColumns);
Then in the handler, use code like:
void grid_ResizingColumns(object sender, GridResizingColumnsEventArgs args)
{
args.AllowResize = false;
}
JD
Jean-Marc DUHEN
October 16, 2009 01:17 PM UTC
Thank you,
it is working perfectly.
Br,
Jean-Marc
RH
Rafael Huapaya
October 19, 2009 04:56 PM UTC
GK
Ganesan K
Syncfusion Team
October 21, 2009 05:00 AM UTC
Thanks for your feedbacks.
Thanks
Ganesan
ER
Ezequiel Reyno
December 18, 2009 01:54 PM UTC
Hi,
I need know how I can give to a column a minWidth? I need allow a resize but I need stop them when is equal or minor than some value.
I make this but doesn't work because when I put false in the property AllowResize I can't resize this column anymore.
Private Sub grid_ResizingColumns(ByVal sender As Object, ByVal args As Syncfusion.Windows.Controls.Grid.GridResizingColumnsEventArgs) Handles grid.ResizingColumns
If args.Width < 90 Then
args.AllowRisize = False
End If
End Sub
thanks
Ezequiel
GK
Ganesan K
Syncfusion Team
December 21, 2009 06:48 PM UTC
Hi Ezequiel,
Thanks for using Syncfusion products.
For this you need to listen to the ResizingColumns event as follows
this.dataGrid.Model.Grid.ResizingColumns += new GridResizingColumnsEventHandler(Grid_ResizingColumns);
double minColumnWidth = 90;
void Grid_ResizingColumns(object sender, GridResizingColumnsEventArgs args)
{
switch (args.Reason)
{
case GridResizeCellsReason.MouseMove:
if (args.Width < minColumnWidth)
args.AllowResize = false;
break;
case GridResizeCellsReason.MouseUp:
{
GridControlBase grid = sender as GridControlBase;
grid.Model.ColumnWidths[args.Columns.Left] = Math.Max(args.Width, minColumnWidth);
args.Handled = true;
args.AllowResize = false; //handled directly... grid does not have to do anything
}
break;
default:
break;
}
}
Please let us know if you need any more details.
Thanks
Ganesan