This is a migrated thread and some comments may be shown as answers.

How can I change a RadLabel font? Nothing seems to work.

4 Answers 378 Views
Label
This is a migrated thread and some comments may be shown as answers.
Laszlo
Top achievements
Rank 1
Laszlo asked on 18 Feb 2014, 02:11 PM
Hello there :)

First of all, this is my first time using Telerik and I`m loving it so far. :D

I`m trying to change the font size of some labels, and I need to do it runtime, after applying the initial theme. I have tried label.Font = new Font(labelFont.Name, 20f, FontStyle.Regular); and label.LabelElement.Font = new Font(labelFont.Name, 20f, FontStyle.Regular); none of them work. The function does get called, the font does get changed in memory, checked it with a breakpoint. How would I go about this?

4 Answers, 1 is accepted

Sort by
0
Laszlo
Top achievements
Rank 1
answered on 18 Feb 2014, 02:28 PM
Managed to do this :

((TextPrimitive)label.LabelElement.Children[2].Children[1]).Font = new Font(labelFont.Name, 12f, FontStyle.Regular);
0
Stefan
Telerik team
answered on 18 Feb 2014, 04:10 PM
Hello Laszlo,

Thank you for writing. 

I have tested the property mentioned and it seems to be working just fine on my end - see attached video (opens in browser). Setting the Font to the TextPrimitive is also an option. Feel free to use it, but can I please ask you for more details about the case you experience issue with the control property, so I can make sure everything is OK with the control.

Thank you in advance for your time and cooperation.

Regards,
Stefan
Telerik
0
Laszlo
Top achievements
Rank 1
answered on 20 Feb 2014, 08:57 AM
Sorry for the late reply. After a bit of investigation, the error was at my end. The font was set two times, thus overriding the first one, after removing that, it works wonders. :)
0
Stefan
Telerik team
answered on 20 Feb 2014, 01:52 PM
Hi Laszlo,

Great to hear everything is working fine now. 

Regards,
Stefan
Telerik
Tags
Label
Asked by
Laszlo
Top achievements
Rank 1
Answers by
Laszlo
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or