Hello there,
I have changed the default Segoe font to Arial 9pt for my RadGridView using the IDE. But the drop-downlist of items in a GridViewComboBoxColumn does not follow and still displays as Segoe. There is no option in the IDE to alter it. I am trying to find out how to alter the font of the drop-down list in code please? (vb.net)
I imagine I could use VisualStyle builder but I cannot seem to export from that all the settings for a given off-the-shelf theme, and I do not havethe time to make a whole theme with all it's settings...
Thanks in advance
I have changed the default Segoe font to Arial 9pt for my RadGridView using the IDE. But the drop-downlist of items in a GridViewComboBoxColumn does not follow and still displays as Segoe. There is no option in the IDE to alter it. I am trying to find out how to alter the font of the drop-down list in code please? (vb.net)
I imagine I could use VisualStyle builder but I cannot seem to export from that all the settings for a given off-the-shelf theme, and I do not havethe time to make a whole theme with all it's settings...
Thanks in advance
7 Answers, 1 is accepted
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 05 Apr 2011, 06:55 PM
Hello Ian,
You can set a different font for the DropDown by subscribing to the CellEditorInitialized event as follows:
Hope that helps
Richard
You can set a different font for the DropDown by subscribing to the CellEditorInitialized event as follows:
private
void
radGridView1_CellEditorInitialized(
object
sender, GridViewCellEventArgs e)
{
var editor = e.ActiveEditor;
if
(editor !=
null
&& editor
is
RadDropDownListEditor)
{
RadDropDownListEditor dropDown = (RadDropDownListEditor)editor;
RadDropDownListEditorElement element = (RadDropDownListEditorElement)dropDown.EditorElement;
element.Font =
// a font
element.ListElement.Font =
// a font
}
}
Hope that helps
Richard
0
Ian
Top achievements
Rank 1
answered on 07 Apr 2011, 05:44 AM
Thank you Richard
That worked once I managed to convert it to vb.
Thanks again.
That worked once I managed to convert it to vb.
Thanks again.
0
Ian
Top achievements
Rank 1
answered on 07 Apr 2011, 05:46 AM
Dim
editor = e.ActiveEditor
If
editor IsNot
Nothing
AndAlso
TypeOf
editor
Is
RadDropDownListEditor
Then
Dim
dropDown
As
RadDropDownListEditor =
DirectCast
(editor, RadDropDownListEditor)
Dim
element
As
RadDropDownListEditorElement =
DirectCast
(dropDown.EditorElement, RadDropDownListEditorElement)
element.Font =
New
Font(
"Arial"
, 9)
element.ListElement.Font =
New
Font(
"Arial"
, 9)
End
If
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 07 Apr 2011, 09:01 AM
Hi,
Glad that helped. Just one other thing. You may have already realised but it would be better to maintain a private member of the font that you need and assign that rather than create a new instance of the font each time CellEditorInitialized is raised.
Hope that helps
Richard
Glad that helped. Just one other thing. You may have already realised but it would be better to maintain a private member of the font that you need and assign that rather than create a new instance of the font each time CellEditorInitialized is raised.
Hope that helps
Richard
0
Ian
Top achievements
Rank 1
answered on 12 Apr 2011, 10:15 AM
Thanks Richard, yes. I had guessed as much and will do so.
Thanks so much for your help!
Thanks so much for your help!
0
Zeone Informatica
Top achievements
Rank 2
answered on 11 Mar 2014, 05:00 PM
Hi there, I'm having the same issue, I've tested Richard Slade code, and it worked but when I type something in the autocomplete area the font changes again to the default value..
Any sugestion?
Thanks
Any sugestion?
Thanks
0
Hello Jose,
The observed behavior is expected, as the auto complete functionality has its own popup with its own ListElement in it, so you have to set the Font of the latter as well. Here is the modified snippet:
I hope that the provided information addresses your question.
Best wishes,
Stefan
the Telerik team
The observed behavior is expected, as the auto complete functionality has its own popup with its own ListElement in it, so you have to set the Font of the latter as well. Here is the modified snippet:
Font f =
new
Font(
"Consolas"
, 12);
private
void
radGridView1_CellEditorInitialized(
object
sender, GridViewCellEventArgs e)
{
var editor = e.ActiveEditor;
if
(editor !=
null
&& editor
is
RadDropDownListEditor)
{
RadDropDownListEditor dropDown = (RadDropDownListEditor)editor;
RadDropDownListEditorElement element = (RadDropDownListEditorElement)dropDown.EditorElement;
element.Font = f;
element.ListElement.Font = f;
element.AutoCompleteSuggest.DropDownList.ListElement.Font = f;
}
}
I hope that the provided information addresses your question.
Best wishes,
Stefan
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