How can I display multiple lines of text in a column group header? I can't see my "Line2" text in the sample below
public
Form1()
{
InitializeComponent();
ColumnGroupsViewDefinition view =
new
ColumnGroupsViewDefinition();
List<String> cols =
new
List<
string
> () {
"column2"
,
"column3"
};
view.ColumnGroups.Add (CreateColGroup (cols,
"Customer Contact"
));
view.ColumnGroups.Add(CreateColGroup(
new
List<
string
> (){
"DNE"
,
"column1"
},
""
));
this
.radGridView1.ViewDefinition = view;
}
private
GridViewColumnGroup CreateColGroup (List<
string
> cols,
string
groupName)
{
var colGroup =
new
GridViewColumnGroup(groupName);
var groupRow =
new
GridViewColumnGroupRow();
foreach
(var colName
in
cols)
{
if
(
this
.radGridView1.Columns[colName] !=
null
)
{
groupRow.Columns.Add (
this
.radGridView1.Columns[colName]);
}
}
foreach
(var col
in
groupRow.Columns)
{
col.HeaderText +=
"\n Line2"
;
}
colGroup.Rows.Add(groupRow);
return
colGroup;
}
6 Answers, 1 is accepted
0
Accepted
Hello Karl,
Thank you for writing.
You can set the MinHeight of the group row:
Or you can set the AutoSizeRows property of the grid:
Let me know if I can assist you further.
Regards,
Dimitar
Telerik
Thank you for writing.
You can set the MinHeight of the group row:
private
GridViewColumnGroup CreateColGroup(List<
string
> cols,
string
groupName)
{
var colGroup =
new
GridViewColumnGroup(groupName);
var groupRow =
new
GridViewColumnGroupRow();
foreach
(var colName
in
cols)
{
if
(
this
.radGridView1.Columns[colName] !=
null
)
{
groupRow.Columns.Add(
this
.radGridView1.Columns[colName]);
}
}
foreach
(var col
in
groupRow.Columns)
{
col.HeaderText +=
"\n Line2"
;
}
groupRow.MinHeight = 40;
colGroup.Rows.Add(groupRow);
return
colGroup;
}
Or you can set the AutoSizeRows property of the grid:
radGridView1.AutoSizeRows =
true
;
Let me know if I can assist you further.
Regards,
Dimitar
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Karl B
Top achievements
Rank 1
answered on 26 Jan 2016, 08:35 PM
Setting the MinHeight works but AutoSizeRows = true appears to have no effect.
0
Karl B
Top achievements
Rank 1
answered on 26 Jan 2016, 09:03 PM
Forgot to mention this was with UI for WinForms Q1 2015. DLL version is 2015.1.331.20.
0
Hello Karl,
Thank you for writing back.
Yes, I can confirm that the AutoSizeRows would not work with the old version. If you want to use this feature you should upgrade to latest version. If you cannot upgrade you can use the MinHeight property.
Do not hesitate to contact us if you have other questions.
Regards,
Dimitar
Telerik
Thank you for writing back.
Yes, I can confirm that the AutoSizeRows would not work with the old version. If you want to use this feature you should upgrade to latest version. If you cannot upgrade you can use the MinHeight property.
Do not hesitate to contact us if you have other questions.
Dimitar
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Karl B
Top achievements
Rank 1
answered on 27 Jan 2016, 03:46 PM
The MinHeight solution you provided changes all rows. Is there any way to change just the height row height of the grouped column?
0
Hello Karl,
Thank you for writing back.
You can use the ViewRowFormatting event to set the height of all other rows:
I hope this will be useful.
Regards,
Dimitar
Telerik
Thank you for writing back.
You can use the ViewRowFormatting event to set the height of all other rows:
void
radGridView1_ViewRowFormatting(
object
sender, RowFormattingEventArgs e)
{
e.RowElement.RowInfo.Height = 23;
}
I hope this will be useful.
Regards,
Dimitar
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items