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

Minimum row height in GridDataControl

I am using GridDataVisibleColumn to create the columns in my grid and I set the minimum width of each column by using
gridDataVisibleColumn's MinimumWidth.


Is there a way to set the minimum height of the rows in gridDataControl?



3 Replies

RA Rajasekar Syncfusion Team October 6, 2011 11:08 AM UTC

Hi Mary,

Thanks for your update, You can achieve your requirement by setting the below properties,

Code Snippet[C#]

this.dataGrid.DefaultHeaderRowHeight = 50;
this.dataGrid.Model.RowHeights.DefaultLineSize = 50;

Please let us know if you have any queries.

Thanks,
Rajasekar




MF Mary Fontana October 11, 2011 08:11 PM UTC

But setting

this.dataGrid.DefaultHeaderRowHeight = 50;
this.dataGrid.Model.RowHeights.DefaultLineSize = 50;

doesnt set a minimum height.

The problem I have is that if I allow a user can hide a row. Then there is no way to get the row back.
So I was thinking I could give a minimum row height of for example 2.
So that the hidden row will still have height of 2 and can be expanded if the user double clicks on it.

A similar issue is when a user hides a column.
I give it a minimum column width of 2. And part of the column is still visible so that it can be expanded if user double clicks on it.

in documentation
section 4.1.3.7 I say this
this.gridControl.Model.HiddenBorderBrush = Brushes.Red ;
this.gridControl.Model.HiddenBorderThikness = 3;

But I could not find these properties in GridDataControl.






RA Rajasekar Syncfusion Team November 3, 2011 08:53 AM UTC

Hi Mary,

You can achieve your requirement by using the below code snippet,

Code Snippet[C#]

dataGrid1.ResizingColumns += new GridResizingColumnsEventHandler(dataGrid1_ResizingColumns);
dataGrid1.ResizingRows += new GridResizingRowsEventHandler(dataGrid1_ResizingRows);

void dataGrid1_ResizingRows(object sender, GridResizingRowsEventArgs args)
{
if (args.Height < 10)
{
this.dataGrid1.Model.RowHeights[args.Rows.Top] = 10;
args.AllowResize = false;
}
}

void dataGrid1_ResizingColumns(object sender, GridResizingColumnsEventArgs args)
{
if (args.Width < 5)
args.Width = 5;
}

Please let us know if you have any queries.

Thanks,
Rajasekar




Loader.
Live Chat Icon For mobile
Up arrow icon