RadForm title alignment

5 posts, 0 answers
  1. Nathalie
    Nathalie avatar
    4 posts
    Member since:
    Nov 2012

    Posted 05 Sep 2014 Link to this post

    Hello,


    How can I center the title of my RadForm?

    Thanks.
  2. Mark
    Mark avatar
    2 posts
    Member since:
    Feb 2015

    Posted 26 Jun 2015 Link to this post

    A was a very informative answer to this straightforward question
  3. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3374 posts

    Posted 01 Jul 2015 Link to this post

    Hello Nathalie,

    Thank you for writing.

    In order to center the text in the title-bar, you can use the following code snippet:
    public Form1()
    {
        InitializeComponent();
     
        this.FormElement.TitleBar.TitlePrimitive.StretchHorizontally = true;
        this.FormElement.TitleBar.TitlePrimitive.TextAlignment = ContentAlignment.MiddleCenter;
    }

    I hope this information helps. Should you have further questions, I would be glad to help.
     
    Regards,
    Dess
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  4. Ashish
    Ashish avatar
    1 posts
    Member since:
    Mar 2019

    Posted 16 Apr in reply to Dess | Tech Support Engineer, Sr. Link to this post

    The following code doesn't work for the RadForm's title-text alignment. I am using the Crystal theme.

    this.FormElement.TitleBar.TitlePrimitive.StretchHorizontally = true;
    this.FormElement.TitleBar.TitlePrimitive.TextAlignment = ContentAlignment.MiddleLeft;
  5. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3374 posts

    Posted 17 Apr Link to this post

    Hello, Ashish,     

    Note that in Crystal theme, the title-bar is in right-to-left mode. That is why setting the TitlePrimitive.TextAlignment property to left doesn't have effect. Feel free to set it to ContentAlignment.MiddleRight in order to obtain the following result:

    ThemeResolutionService.ApplicationThemeName = "Crystal";
     
    this.FormElement.TitleBar.TitlePrimitive.StretchHorizontally = true;
    this.FormElement.TitleBar.TitlePrimitive.TextAlignment = ContentAlignment.MiddleRight;



    I hope this information helps.

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top