Adjusting the layout of the panelbar

3 posts, 0 answers
  1. kstump
    kstump avatar
    4 posts
    Member since:
    Jul 2007

    Posted 09 Jul 2007 Link to this post

    What I'm attempting to do is put the caption text and the image on the right side of the panelbar.    Setting it at runtime would be fine, but I'd rather be able to set them at design time if it's possible.

    It seems that there are many ways to set this, but I'd like to know the right way. 
    I've been using the RadControlSpy to adjust the settings.
    Navigating down the tree to the RadCaptionLayout and setting the CaptionButtonPosition to Right seems like the right thing, but it doesn't move the image.
    Navigating to the ImagePrimitive and setting it's alignment to right  moves the image, but it moves it past the end of the panelbar.

    Is there a better way to make these changes?
    I'm new to the telerik controls, so feel free to point out obvious things.

  2. Boyko Markov
    Boyko Markov avatar
    610 posts

    Posted 10 Jul 2007 Link to this post

    Hi kstump,

    We don't support this functionality in the current version of the control, but we will evaluate adding it for the next release of RadControls for WinForms.

    At present I can propose you the following solution:
    1. Access the caption layout of a RadPanelBarGroupElement
    2. Get the caption layout's width
    3. Set caption layout's left margin to the appropriate value. The code below demonstrates how that can be done:
                  RadCaptionLayout captionLayout = this.radPanelBarGroupElement1.Children[2].Children[0].Children[0] as RadCaptionLayout;     
                  int childrenWidth = 0;     
                  for (int i = 0; i < captionLayout.Children.Count; i++)     
                      if ( captionLayout.Children[i].Visibility == Telerik.WinControls.ElementVisibility.Visible )     
                          childrenWidth = Math.Max( childrenWidth, captionLayout.Children[i].Bounds.Right );     
                  captionLayout.Margin = new Padding(this.radPanelBarGroupElement1.Bounds.Width - childrenWidth, captionLayout.Margin.Top,     
                      captionLayout.Margin.Right, captionLayout.Margin.Bottom);    

    If you want to change the offset, you should only play with the left margin of the caption layout.

    All the best,
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. DevCraft R3 2016 release webinar banner
  4. kstump
    kstump avatar
    4 posts
    Member since:
    Jul 2007

    Posted 10 Jul 2007 Link to this post

    Yes.    That makes sense.  it doesn't handle a resize automagically, but I can just hook it to the event.

    Thanks for your help.
Back to Top