Hi
i'm using radGridView and it seems that i cant set the grid header font at design time.
i've tried Element Hierarchy Editor and i've set my font in GridHeaderElement, but it seems it does not work.
i'm using 2010 Q2 and my grid is in ( RightToLeft = True) mode.
is there any other way to modify grid header at runtime?
ps: i also cant set header height in Element Hierarchy Editor :(
tanx in advance
i'm using radGridView and it seems that i cant set the grid header font at design time.
i've tried Element Hierarchy Editor and i've set my font in GridHeaderElement, but it seems it does not work.
i'm using 2010 Q2 and my grid is in ( RightToLeft = True) mode.
is there any other way to modify grid header at runtime?
ps: i also cant set header height in Element Hierarchy Editor :(
tanx in advance
4 Answers, 1 is accepted
0

M_M
Top achievements
Rank 1
answered on 22 Jun 2010, 05:09 PM
i'm working with that grid still, and sometimes, there is a "Telerik.WinControls.UI.GridTableHeaderRowElement" in Element Hierarchy Editor . when that is available, i can set the font in it, and the grid header font will change(in design time). but when i run the application, an exception is thrown in
((Telerik.WinControls.UI.GridHeaderCellElement)(this.lstMessages.GetChildAt(0).GetChildAt(1).GetChildAt(0).GetChildAt(0))).Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
and it says
System.ArgumentOutOfRangeException
Message="Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index"
and then the "Telerik.WinControls.UI.GridTableHeaderRowElement" item will disappear from Element Hierarchy Editor.
i'm just so confused
((Telerik.WinControls.UI.GridHeaderCellElement)(this.lstMessages.GetChildAt(0).GetChildAt(1).GetChildAt(0).GetChildAt(0))).Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
and it says
System.ArgumentOutOfRangeException
Message="Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index"
and then the "Telerik.WinControls.UI.GridTableHeaderRowElement" item will disappear from Element Hierarchy Editor.
i'm just so confused
0
Hello vbearn,
If you aim to set the font only to the GridHeaderCellElement-s you can realize it at runtime using the ViewCellFormatting event:
To set the header height in runtime please use:
I hope this helps.
Regards,
Alexander
the Telerik team
Unlike the other controls RadGridView changes its element tree dynamically at runtime. This is because it uses UI virtualization for its rows and cells. Only rows that are currently visible have corresponding visual elements and upon scrolling they are reused. Because of this you can't edit grid rows by using the element hierarchy editor at design-time. You should use the Visual Style Builder or do the changes by code.
For example, you can change the font of the GridTableElement programmatically. It will change the font of the GridHeaderCellElement-s which you have marked in the attached picture. This font will be inherited from all RadGridView elements under GridTableElement as well:
((GridTableElement)radGridView1.GridElement).Font =
new
Font(
new
FontFamily(
"Tahoma"
), 8.25f);
If you aim to set the font only to the GridHeaderCellElement-s you can realize it at runtime using the ViewCellFormatting event:
private
void
radGridView1_ViewCellFormatting(
object
sender, CellFormattingEventArgs e)
{
GridHeaderCellElement cell = e.CellElement
as
GridHeaderCellElement;
if
(cell !=
null
)
{
cell.Font =
new
Font(
new
FontFamily(
"Tahoma"
), 8.25f);
}
}
To set the header height in runtime please use:
((GridTableElement)radGridView1.GridElement).TableHeaderHeight = 50;
I hope this helps.
Regards,
Alexander
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0

M_M
Top achievements
Rank 1
answered on 27 Jun 2010, 01:25 PM
tanx admin.
i needed specifically to set grid font in design time, so i created a new theme with visual style builder, with my desired font. and set the theme to my application. a bit hard, but it worked finally :D
plz consider this feature in your next releases, it really is handy.
tanx again
i needed specifically to set grid font in design time, so i created a new theme with visual style builder, with my desired font. and set the theme to my application. a bit hard, but it worked finally :D
plz consider this feature in your next releases, it really is handy.
tanx again
0
Hello vbearn vb,
RadGridView uses rows and columns virtualization - creates its elements in runtime and reuses them. I explained in my previous post why it prevents setting Header Font at design time.
Setting the style you need in the theme seems the best option you have. The other one is in runtime.
Do not hesitate to contact us if you have other questions.
Greetings,
Alexander
the Telerik team
RadGridView uses rows and columns virtualization - creates its elements in runtime and reuses them. I explained in my previous post why it prevents setting Header Font at design time.
Setting the style you need in the theme seems the best option you have. The other one is in runtime.
Do not hesitate to contact us if you have other questions.
Greetings,
Alexander
the Telerik team
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 Public Issue Tracking
system and vote to affect the priority of the items