3 Answers, 1 is accepted
0
Hi Veda,
Thank you for writing.
You can customize the group header appearance by handling the ViewCellFormatting event. You should modify GridGroupContentCellElement properties in this case:
You may also want to change how specific text parts look. The easiest way to do this is by handling GroupSummaryEvaluate event and use our html like syntax:
To enable this feature on you should set the DisableHTMLRendering property to false when handling ViewCellFormatting event:
I hope this helps.
All the best,
Jack
the Telerik team
Thank you for writing.
You can customize the group header appearance by handling the ViewCellFormatting event. You should modify GridGroupContentCellElement properties in this case:
void
radGridView1_ViewCellFormatting(
object
sender, CellFormattingEventArgs e)
{
GridGroupContentCellElement contentCell = e.CellElement
as
GridGroupContentCellElement;
if
(contentCell !=
null
)
{
if
(font ==
null
)
{
font =
new
Font(
"Comic Sans MS"
, 12, FontStyle.Regular);
}
contentCell.Font = font;
contentCell.ForeColor = Color.Red;
}
}
You may also want to change how specific text parts look. The easiest way to do this is by handling GroupSummaryEvaluate event and use our html like syntax:
void
radGridView1_GroupSummaryEvaluate(
object
sender, GroupSummaryEvaluationEventArgs e)
{
if
(e.Context
is
GridViewGroupRowInfo)
{
e.FormatString =
"<html><b>{0}:</b><font='Courier MS'><color=green><i>{1}</i>"
;
}
}
To enable this feature on you should set the DisableHTMLRendering property to false when handling ViewCellFormatting event:
void
radGridView1_ViewCellFormatting(
object
sender, CellFormattingEventArgs e)
{
GridGroupContentCellElement contentCell = e.CellElement
as
GridGroupContentCellElement;
if
(contentCell !=
null
)
{
contentCell.DisableHTMLRendering =
false
;
}
}
I hope this helps.
All the best,
Jack
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
0
Roger
Top achievements
Rank 1
answered on 23 Mar 2013, 06:18 PM
Hi coders
to get the font to display correctly I had to remove the single quotes. My font name was a single word, eg Arial. Not sure what would happen if there was a space in the font name - as in the example. Maybe then the single quotes would be necessary. Here's the corrected, working (for me) code
"<html><b>{0}:</b><font=Arial><color=green><i>{1}</i>"
;
I hope this helps someone.
Useful code as I needed it to change the group font at {1}
Roger
0
Hi Roger,
Yes, your solution is correct. Presently there is an issue when the font name is surrounded with single quotes. I logged the issue in our issue tracking system and we will address it in one of our upcoming releases. Use this link to track the issue status. I updated your Telerik points for this report.
Greetings,
Jack
the Telerik team
Yes, your solution is correct. Presently there is an issue when the font name is surrounded with single quotes. I logged the issue in our issue tracking system and we will address it in one of our upcoming releases. Use this link to track the issue status. I updated your Telerik points for this report.
Greetings,
Jack
the Telerik team
WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more.
Check out all of the latest highlights.