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

Adjusting the layout of the panelbar

2 Answers 100 Views
Panelbar (obsolete as of Q2 2010)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
kstump
Top achievements
Rank 1
kstump asked on 09 Jul 2007, 09:18 PM
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.
--
K



2 Answers, 1 is accepted

Sort by
0
Boyko Markov
Telerik team
answered on 10 Jul 2007, 04:15 PM
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,
Ray
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
kstump
Top achievements
Rank 1
answered on 10 Jul 2007, 07:42 PM
Yes.    That makes sense.  it doesn't handle a resize automagically, but I can just hook it to the event.

Thanks for your help.
--
K
Tags
Panelbar (obsolete as of Q2 2010)
Asked by
kstump
Top achievements
Rank 1
Answers by
Boyko Markov
Telerik team
kstump
Top achievements
Rank 1
Share this question
or