How can I can I make second row of headings taller when I use the ColumnGroupsViewDefinition?
I've tried ...
...and also setting the row height in the group rows...
Niether seem to have any effect.
My heading text also has newlines in it (E.g. "Profit\nMargin")
I've tried ...
grd.GridElement.TableHeaderHeight = 100; |
ColumnGroupsViewDefinition view = new ColumnGroupsViewDefinition(); |
view.ColumnGroups.Add(new GridViewColumnGroup("Vendor")); |
view.ColumnGroups[0].Rows.Add(new GridViewColumnGroupRow()); |
view.ColumnGroups[0].Rows[0].Height = 100; |
My heading text also has newlines in it (E.g. "Profit\nMargin")
15 Answers, 1 is accepted
0
Hi Bill,
Thank you for writing. Currently the Height property of GridViewColumnGroupRow is ignored. You can use the RowSpan property of GridViewColumn instead. Here is sample code:
The TableHeaderHeight is not used when using the ColumnGroupsViewDefinition. We plan to improve our API and address the issues in one of our upcoming releases this year.
Do not hesitate to write me back if you have more questions.
Regards,
Jack
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Thank you for writing. Currently the Height property of GridViewColumnGroupRow is ignored. You can use the RowSpan property of GridViewColumn instead. Here is sample code:
view.ColumnGroups[0].Rows[0].Columns[0].RowSpan = 100; |
The TableHeaderHeight is not used when using the ColumnGroupsViewDefinition. We plan to improve our API and address the issues in one of our upcoming releases this year.
Do not hesitate to write me back if you have more questions.
Regards,
Jack
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0

Bill
Top achievements
Rank 1
answered on 09 Feb 2009, 02:19 PM
Working well. Thank you...
0

Bill
Top achievements
Rank 1
answered on 09 Feb 2009, 02:28 PM
Rats, I mispoke. The heading row did get taller but now it looks like the data rows are taller too. I only want the headings tall. How can I make the headings tall without the data rows below getting taller?
0
Hello Bill,
In column groups view mode, the height of the column headers row is synchronized with the height of all other rows. We will consider changing this behavior in one of our upcoming releases in order to enable the requested functionality.
You should iterate through all rows and set their height manually to work around the issue. Take a look at this code:
Do not hesitate to write us if you need further assistance.
All the best,
Jack
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
In column groups view mode, the height of the column headers row is synchronized with the height of all other rows. We will consider changing this behavior in one of our upcoming releases in order to enable the requested functionality.
You should iterate through all rows and set their height manually to work around the issue. Take a look at this code:
foreach (GridViewDataRowInfo row in this.radGridView1.Rows) |
{ |
row.Height = 20; |
} |
Do not hesitate to write us if you need further assistance.
All the best,
Jack
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0

Celeste Zietsman
Top achievements
Rank 2
answered on 08 Dec 2010, 01:06 PM
Hi Jack
I have the same problem. I'm using version 2010_03_10_1109. I used the work around that you posted but it takes a while for the form to load. Has there been any changes for this in the newer versions?
Thanks
Celeste
I have the same problem. I'm using version 2010_03_10_1109. I used the work around that you posted but it takes a while for the form to load. Has there been any changes for this in the newer versions?
Thanks
Celeste
0

Emanuel Varga
Top achievements
Rank 1
answered on 08 Dec 2010, 02:20 PM
Hello Celeste,
Try wrapping Jack's solution using
Thus preventing the grid from refreshing on each row height change.
Hope this helps, if you have any other questions or comments, please let me know,
Best Regards,
Emanuel Varga
Telerik WinForms MVP
Try wrapping Jack's solution using
radGridView1.BeginUpdate();
// do something
radGridView1.EndUpdate();
// or
using
(radGridView1.DeferRefresh())
{
// do something
}
Thus preventing the grid from refreshing on each row height change.
Hope this helps, if you have any other questions or comments, please let me know,
Best Regards,
Emanuel Varga
Telerik WinForms MVP
0
Hi Celeste Veotte,
Besides the solutions that Emanuel suggested you can initialize the MinHeight property when handling the CreateRowInfo event which we added in Q3 2010. Consider the code snippet below:
I hope this helps.
Greetings,
Jack
the Telerik team
Besides the solutions that Emanuel suggested you can initialize the MinHeight property when handling the CreateRowInfo event which we added in Q3 2010. Consider the code snippet below:
this
.radGridView1.MasterTemplate.CreateRowInfo +=
new
GridViewCreateRowInfoEventHandler(MasterTemplate_CreateRowInfo);
void
MasterTemplate_CreateRowInfo(
object
sender, GridViewCreateRowInfoEventArgs e)
{
e.RowInfo.SuspendPropertyNotifications();
e.RowInfo.MinHeight = 25;
e.RowInfo.ResumePropertyNotifications();
}
I hope this helps.
Greetings,
Jack
the Telerik team
0

John
Top achievements
Rank 1
answered on 25 Apr 2018, 06:07 PM
Hi,
Has there been any update on this issue in the past 7 years - setting the height of the column headers when using ColumnGroupsViewDefinitions?
Thanks,
John
0
Hello, John,
You can manipulate the height of the column group headers by setting the RowSpan property. Here is a sample code snippet which result is illustrated in the below screenshot. The Details group is 100 px high and the Address group is 50 px high.

I hope this information helps. If you have any additional questions, please let me know.
Regards,
Dess
Progress Telerik
You can manipulate the height of the column group headers by setting the RowSpan property. Here is a sample code snippet which result is illustrated in the below screenshot. The Details group is 100 px high and the Address group is 50 px high.
ColumnGroupsViewDefinition view =
new
ColumnGroupsViewDefinition();
view.ColumnGroups.Add(
new
GridViewColumnGroup(
"Customer Contact"
));
view.ColumnGroups.Add(
new
GridViewColumnGroup(
"Details"
));
view.ColumnGroups[1].Groups.Add(
new
GridViewColumnGroup(
"Address"
));
view.ColumnGroups[1].Groups.Add(
new
GridViewColumnGroup(
"Contact"
));
view.ColumnGroups[0].Rows.Add(
new
GridViewColumnGroupRow());
view.ColumnGroups[0].Rows[0].ColumnNames.Add(
"CompanyName"
);
view.ColumnGroups[0].Rows[0].ColumnNames.Add(
"ContactName"
);
view.ColumnGroups[0].Rows[0].ColumnNames.Add(
"ContactTitle"
);
view.ColumnGroups[1].Groups[0].Rows.Add(
new
GridViewColumnGroupRow());
view.ColumnGroups[1].Groups[0].Rows[0].ColumnNames.Add(
"Address"
);
view.ColumnGroups[1].Groups[0].Rows[0].ColumnNames.Add(
"City"
);
view.ColumnGroups[1].Groups[0].Rows[0].ColumnNames.Add(
"Country"
);
view.ColumnGroups[1].Groups[1].Rows.Add(
new
GridViewColumnGroupRow());
view.ColumnGroups[1].Groups[1].Rows[0].ColumnNames.Add(
"Phone"
);
view.ColumnGroups[1].Groups[1].Rows[0].ColumnNames.Add(
"Fax"
);
view.ColumnGroups[1].RowSpan = 100;
view.ColumnGroups[1].Groups[0].RowSpan = 50;
radGridView1.ViewDefinition = view;
I hope this information helps. If you have any additional questions, please let me know.
Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which
deliver the business app essential building blocks - a grid component,
data visualization (charts) and form elements.
0

John
Top achievements
Rank 1
answered on 26 Apr 2018, 03:50 PM
Hi Dess,
How can I change the height of the Row, where all the column names are displayed (Company Name, Address, etc.).
Thanks,
John
0
Hello, John,
In order to change the height of the header row you can specify the MinHeight property of the respective GridViewColumnGroupRow in the GridViewColumnGroup:

I hope this information helps. If you have any additional questions, please let me know.
Regards,
Dess
Progress Telerik
In order to change the height of the header row you can specify the MinHeight property of the respective GridViewColumnGroupRow in the GridViewColumnGroup:
view.ColumnGroups[0].Rows[0].MinHeight = 30;
radGridView1.ViewDefinition = view;
I hope this information helps. If you have any additional questions, please let me know.
Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which
deliver the business app essential building blocks - a grid component,
data visualization (charts) and form elements.
0

Dilshod
Top achievements
Rank 1
answered on 01 Jul 2018, 12:31 PM
Hello,
Setting a value to RowSpan property is not working if grid AutoRowSize = true. Any solution?
0
Hello, Dilshod,
When the AutoRowSize property is set to true, the rows in RadGridView are sized according to the content they have. That is why properties that affect the row's height are not respected in this case.
I hope this information helps. If you have any additional questions, please let me know.
Regards,
Dess
Progress Telerik
When the AutoRowSize property is set to true, the rows in RadGridView are sized according to the content they have. That is why properties that affect the row's height are not respected in this case.
I hope this information helps. If you have any additional questions, please let me know.
Dess
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which
deliver the business app essential building blocks - a grid component,
data visualization (charts) and form elements.
0

Dilshod
Top achievements
Rank 1
answered on 02 Jul 2018, 12:25 PM
Hello Dess,
So, in order to set RowSpan manually, I have to set AutoRowSize property to false. But then, how to calculate the height of the data rows where two or more lines of text?
0
Hello, Dilshod,
You can iterate all columns in RadGridView and set the GridViewColumn.WrapText property to true. Thus, the cell values will be wrapped. In addition, you can use the demonstrated approach in the following help article showing how to autosize the entire row by measuring the content. For this purpose it is necessary to create a custom GridDataRowElement: https://docs.telerik.com/devtools/winforms/gridview/rows/how-to/autosize-entire-row
As a result, you will have the desired minimum height for the headers in the ColumnGroupsViewDefinition and autosize the data rows as it is illustrated in the screenshot.

Here is a complete code snippet:
I hope this information helps. If you have any additional questions, please let me know.
Progress Telerik
You can iterate all columns in RadGridView and set the GridViewColumn.WrapText property to true. Thus, the cell values will be wrapped. In addition, you can use the demonstrated approach in the following help article showing how to autosize the entire row by measuring the content. For this purpose it is necessary to create a custom GridDataRowElement: https://docs.telerik.com/devtools/winforms/gridview/rows/how-to/autosize-entire-row
As a result, you will have the desired minimum height for the headers in the ColumnGroupsViewDefinition and autosize the data rows as it is illustrated in the screenshot.
Here is a complete code snippet:
public
RadForm1()
{
InitializeComponent();
this
.radGridView1.CreateRow += radGridView1_CreateRow;
foreach
(GridViewColumn col
in
this
.radGridView1.Columns)
{
col.WrapText =
true
;
}
}
private
void
radGridView1_CreateRow(
object
sender, GridViewCreateRowEventArgs e)
{
if
(e.RowType ==
typeof
(GridDataRowElement))
{
e.RowType =
typeof
(CustomRowElement);
}
}
private
void
RadForm1_Load(
object
sender, EventArgs e)
{
this
.customersTableAdapter.Fill(
this
.nwindDataSet.Customers);
ColumnGroupsViewDefinition view =
new
ColumnGroupsViewDefinition();
view.ColumnGroups.Add(
new
GridViewColumnGroup(
"Customer Contact"
));
view.ColumnGroups.Add(
new
GridViewColumnGroup(
"Details"
));
view.ColumnGroups[1].Groups.Add(
new
GridViewColumnGroup(
"Address"
));
view.ColumnGroups[1].Groups.Add(
new
GridViewColumnGroup(
"Contact"
));
view.ColumnGroups[0].Rows.Add(
new
GridViewColumnGroupRow());
view.ColumnGroups[0].Rows[0].ColumnNames.Add(
"CompanyName"
);
view.ColumnGroups[0].Rows[0].ColumnNames.Add(
"ContactName"
);
view.ColumnGroups[0].Rows[0].ColumnNames.Add(
"ContactTitle"
);
view.ColumnGroups[1].Groups[0].Rows.Add(
new
GridViewColumnGroupRow());
view.ColumnGroups[1].Groups[0].Rows[0].ColumnNames.Add(
"Address"
);
view.ColumnGroups[1].Groups[0].Rows[0].ColumnNames.Add(
"City"
);
view.ColumnGroups[1].Groups[0].Rows[0].ColumnNames.Add(
"Country"
);
view.ColumnGroups[1].Groups[1].Rows.Add(
new
GridViewColumnGroupRow());
view.ColumnGroups[1].Groups[1].Rows[0].ColumnNames.Add(
"Phone"
);
view.ColumnGroups[1].Groups[1].Rows[0].ColumnNames.Add(
"Fax"
);
view.ColumnGroups[1].RowSpan = 100;
view.ColumnGroups[1].Groups[0].RowSpan = 50;
view.ColumnGroups[0].Rows[0].MinHeight = 30;
radGridView1.ViewDefinition = view;
}
public
class
CustomRowElement : GridDataRowElement
{
protected
override
Type ThemeEffectiveType
{
get
{
return
typeof
(GridDataRowElement);
}
}
protected
override
SizeF MeasureOverride(SizeF availableSize)
{
SizeF baseSize =
base
.MeasureOverride(availableSize);
CellElementProvider provider =
new
CellElementProvider(
this
.TableElement);
SizeF desiredSize = SizeF.Empty;
foreach
(GridViewColumn column
in
this
.ViewTemplate.Columns)
{
if
(!
this
.IsColumnVisible(column))
{
continue
;
}
GridDataCellElement cellElement = provider.GetElement(column,
this
)
as
GridDataCellElement;
this
.Children.Add(cellElement);
if
(cellElement !=
null
)
{
cellElement.Measure(
new
SizeF(column.Width,
float
.PositiveInfinity));
if
(desiredSize.Height < cellElement.DesiredSize.Height)
{
desiredSize.Height = cellElement.DesiredSize.Height;
}
}
cellElement.Detach();
this
.Children.Remove(cellElement);
}
SizeF elementSize =
this
.TableElement.RowScroller.ElementProvider.GetElementSize(
this
.RowInfo);
int
oldHeight = RowInfo.Height == -1 ? (
int
)elementSize.Height : RowInfo.Height;
this
.RowInfo.SuspendPropertyNotifications();
this
.RowInfo.Height = (
int
)desiredSize.Height;
this
.RowInfo.ResumePropertyNotifications();
if
(!
this
.RowInfo.IsPinned)
{
int
delta = RowInfo.Height - oldHeight;
TableElement.RowScroller.UpdateScrollRange(TableElement.RowScroller.Scrollbar.Maximum + delta,
false
);
}
baseSize.Height =
this
.RowInfo.Height;
return
baseSize;
}
private
bool
IsColumnVisible(GridViewColumn column)
{
return
column.IsVisible;
}
}
I hope this information helps. If you have any additional questions, please let me know.
Regards,
Dess Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which
deliver the business app essential building blocks - a grid component,
data visualization (charts) and form elements.