Text Alignment in RadPanel

7 posts, 0 answers
  1. Chris Kirkman
    Chris Kirkman avatar
    11 posts
    Member since:
    Mar 2010

    Posted 30 Mar 2010 Link to this post

    Is there a simple way to set the alignment of text added to this panel to be at the top left?  It defaults to center left.
  2. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 02 Apr 2010 Link to this post

    Hello Chris Kirkman,

    Thank you for your question.

    You should select RadPanel's Smart Tag, trigger the "Edit UI Elements" command, locate the child TextPrimitive and apply the desired value to the TextAlignment property (see the attached screenshot ).

    Another option is to add this line in form's load event:

    this.radPanel1.PanelElement.PanelText.TextAlignment = ContentAlignment.TopCenter;

    I hope this helps. Do not hesitate to contact us if you have other questions.

    Kind regards,
    Peter
    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.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Chris Kirkman
    Chris Kirkman avatar
    11 posts
    Member since:
    Mar 2010

    Posted 02 Apr 2010 Link to this post

    I was optimistic; however neither method worked.

    The first and preferred method DOES change the setting in the "Edit UI Elements" dialog; however at runtime there is no difference whatsoever.  The text is still centered.

    The 2nd method doesn't exist as a property.  From my Panel.PanelElement I can find no "PanelText" property. 

    I'm using the demo version of your latest control set.
  5. Chris Kirkman
    Chris Kirkman avatar
    11 posts
    Member since:
    Mar 2010

    Posted 02 Apr 2010 Link to this post

    I came up with a method that works...

    Declare a member variable...

            TextPrimitive m_text = null;

    In the constructor...

     TextStyle.TextAlignment = ContentAlignment.TopCenter;

    In the class...

            private TextPrimitive TextStyle
            {
                get
                {
                    if (null == m_text)
                    {
                        foreach (RadElement element in m_pnl.PanelElement.Children)
                        {
                            if (element.GetType() == typeof(TextPrimitive))
                            {
                                m_text = (TextPrimitive)element;
                                break;
                            }
                        }                   
                    }

                    return m_text;
                }
            }

  6. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 07 Apr 2010 Link to this post

    Hello Chris Kirkman,

    Please, excuse us for the inconvenience. Yes, we introduced this property in Q1 2010 and  I am happy that you managed to find a solution for your case.
     
    Don't hesitate to contact us if you have other questions.

    Kind regards,
    Peter
    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.
  7. Srinivas
    Srinivas avatar
    1 posts
    Member since:
    Feb 2016

    Posted 11 Jul Link to this post

    i am using windows forms UI and using split container to keep controls based on the requirement, i have hide and show them in c#.

    The problem is if i hide control, that place is reserving as a empty space, once it is hidden, the other controls needs to move up.

    if you see the attached screen you will understand it.  is there any property to set like visibility: collapsed.

     

    thanks in advance.

  8. Hristo Merdjanov
    Admin
    Hristo Merdjanov avatar
    710 posts

    Posted 12 Jul Link to this post

    Hi Srinivas,

    Thank you for writing.

    You can set the Dock property of the controls located in the split panel to Top. This way when you hide the upper control the one underneath will take its location.

    I hope this helps. Should you have further questions please do not hesitate to write back.

    Regards,
    Hristo Merdjanov
    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms. For more information check out this blog post and share your thoughts.
Back to Top
UI for WinForms is Visual Studio 2017 Ready