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

5 posts, 0 answers
  1. Laszlo
    Laszlo avatar
    3 posts
    Member since:
    Jan 2014

    Posted 18 Feb 2014 Link to this post

    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?
  2. Laszlo
    Laszlo avatar
    3 posts
    Member since:
    Jan 2014

    Posted 18 Feb 2014 Link to this post

    Managed to do this :

    ((TextPrimitive)label.LabelElement.Children[2].Children[1]).Font = new Font(labelFont.Name, 12f, FontStyle.Regular);
  3. Stefan
    Admin
    Stefan avatar
    2900 posts

    Posted 18 Feb 2014 Link to this post

    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
  4. Laszlo
    Laszlo avatar
    3 posts
    Member since:
    Jan 2014

    Posted 20 Feb 2014 in reply to Stefan Link to this post

    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. :)
  5. Stefan
    Admin
    Stefan avatar
    2900 posts

    Posted 20 Feb 2014 Link to this post

    Hi Laszlo,

    Great to hear everything is working fine now. 

    Regards,
    Stefan
    Telerik
Back to Top