FlexGrid provides the DefaultSize property of GridRowColCollection<T> class to set the default row height across the grid. You can also specify the width of a particular column by setting the Height property of GridRow class.
Use the code below to set the row height of all rows and a particular row of the FlexGrid.
C# |
Copy Code
|
---|---|
// Set Row Height(all rows) flexGrid1.Rows.DefaultSize = new GridLength(40); // Set Row Height(particular rows) flexGrid1.Rows[2].Height = new GridLength(120); |
To adjust the row height according to the text length, FlexGrid provides the Height property of GridRow class. To enable auto-adjust row height, set the GridLength struct to Auto. The GridLength struct is used to represent a measurement for control logic that explicitly supports **Star** (`*`) sizing and **Auto** sizing.
Following code shows how you can auto adjust the row heights according to the text length in the FlexGrid.
C# |
Copy Code
|
---|---|
// Auto - adjust Row Height
flexGrid1.Rows[0].Height = GridLength.Auto;
|
FlexGrid allows you to set bounds to the column width by using the MinHeight and MaxHeight properties of GridRow class.
Specify the bounds of row height in the FlexGrid using the code below.
C# |
Copy Code
|
---|---|
// Set Min Row Height flexGrid1.Rows[3].MinHeight = 100; // Set Max Row Height flexGrid1.Rows[3].MaxHeight = 250; |