We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

How to catch row/column resize ?

Hi,

In an Essential Grid,
the total width of all the columns is independent from the width of the grid itself. It can be smaller or larger.

It's the same for the total height of all the rows.

I am resizing row/column sizes using frozen rows/columns. I need to catch the row/column resize event in order to adjust the general size of the grid to the total size of all columns.

Example:

private void MyGridRowResize() // Event called when a row is resized
{
MyGrid.Height = TotalHeightOfAllTheRows;
}

How can I accomplish this ?

Thanks in advance

Nazim YENIER



5 Replies

CB Clay Burch Syncfusion Team August 13, 2009 02:47 PM UTC

If I understand what you are asking, I think you can use the GridControl.Model.ColumnWidths.LineSizeChanged event (& RowHeights.LineSizedChanged event) to adjust the grid's width and height as your user changes a column width or row height. Here is a little sample.



WpfApplication17_9e0a6bda.zip


NY Nazim YENIER August 14, 2009 08:28 AM UTC

Hi,
This is almost exactly what I wanted with a little problem:

'LineSizeChanged' fires only when the mouse button is released, not before. So the user can't see the grid changing size while dragging.

What I need is something like :
'LineSizeIsBeingChanged'

I need to adjust the grid general size as the user is moving his mouse to change the row/column size.


CB Clay Burch Syncfusion Team August 14, 2009 12:51 PM UTC

If you only want to catch the action of your user changing rowheights/columnwidths through the UI, then you can use this event instead of the LineSized event.

gridControl1.ResizingRows += new GridResizingRowsEventHandler(gridControl1_ResizingRows);



void gridControl1_ResizingRows(object sender, GridResizingRowsEventArgs args)
{
if (args.Reason == GridResizeCellsReason.MouseMove)
{
SizeGridToFitRowsAndColumns();
}
}


There is also a ResizingColumns even that you can use for the columns as well.


NY Nazim YENIER August 17, 2009 02:54 PM UTC

Excellent !
Works great, thanks.

Nazim YENIER


MS Mohamed Suhaib Fahad A. Syncfusion Team August 19, 2009 11:48 AM UTC

Hi Nazim,

Thanks for your feedbacks. We are glad that you got it working.

Thanks,
Fahad
Grid.WPF Team
Syncfusion Inc.,

Loader.
Live Chat Icon For mobile
Up arrow icon