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

Issue with top caption

3 Answers 89 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.
Schmidty
Top achievements
Rank 2
Schmidty asked on 29 Aug 2009, 06:04 AM
I'm running into a problem with the caption of the group has odd alignment when the form loads. I am using the OutlookNavPane style.

I am programmatically expanding and selecting the first group panel group with code like this:

RadPanelBarGroupElement group = pnlMainNav.Items[0] as RadPanelBarGroupElement; 
if (group != null) { 
  group.Expanded = true
  group.Selected = true
  group.ContentPanel.Controls.Add(new PersonMenuPanel()); 

Everything looks fine  at first as the caption at the top of the PanelBar is correctly named but it is not centered. Manually clicking the panel group button the text centers. I'm not sure what is causing this, but I'd like it display properly when the form loads.

Has anyone experienced this or have a workaround/fix for this?

3 Answers, 1 is accepted

Sort by
0
Boyko Markov
Telerik team
answered on 31 Aug 2009, 01:58 PM
Hi Schmidty,

Thank you for writing us.

I have tested your scenario, but unfortunately I have not been able to reproduce the erroneous behavior. However, I have prepared for you a sample code snippet which will show you how to manually change the text alignment of the RadPanelBar's caption.

  RadPanelBar panelBar = new RadPanelBar(); 
            panelBar.BackColor = Color.White; 
 
            RadPanelBarGroupElement group1 = new RadPanelBarGroupElement(); 
            group1.Caption = "Group1"
 
            RadPanelBarGroupElement group2 = new RadPanelBarGroupElement(); 
            group2.Caption = "Group2"
 
            RadPanelBarGroupElement group3 = new RadPanelBarGroupElement(); 
            group3.Caption = "Group3"
 
            panelBar.GroupStyle = Telerik.WinControls.PanelBarStyles.OutlookNavPane; 
        
            panelBar.Items.Add(group1); 
            panelBar.Items.Add(group2); 
            panelBar.Items.Add(group3); 
 
            panelBar.Bounds = new Rectangle(50, 50, 250, 350); 
            this.Controls.Add(panelBar); 
            group1.Expanded = true
            group1.Selected = true
 
            RadElement element = panelBar.PanelBarElement.Children[0]; 
            RadPanelBarVisualElement caption = element.Children[0] as RadPanelBarVisualElement; 
            if (caption != null
            { 
                caption.TextAlignment = ContentAlignment.MiddleCenter; 
            } 

 
This sample code snippet creates a new RadPanelBar instance in outlook style. Then I add three group elements and select the first one. Finally, I change the text alignment of RadPanelBar's caption.

Please let me know if you need more assistance.

I hope this helps.

All the best,
Boyko Markov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Schmidty
Top achievements
Rank 2
answered on 01 Sep 2009, 12:15 AM
Hi Boyko,

I've compiled a test application that reproduces the issue I described. I'll create a support ticket so I can submit the code.

Thanks,

Mark
0
Boyko Markov
Telerik team
answered on 02 Sep 2009, 07:20 AM
Hello Schmidty,

I debugged your code and I confirm the described behavior. In order to center the text correctly, please remove the serialized CaptionTextFont property value from the designer.cs file. If you want to set the CaptionTextFont, please set it runtime after the InitializeComponent. 

I have updated your Telerik ponts for the report. Please write me back if you need more help.

Greetings,
Boyko Markov
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Panelbar (obsolete as of Q2 2010)
Asked by
Schmidty
Top achievements
Rank 2
Answers by
Boyko Markov
Telerik team
Schmidty
Top achievements
Rank 2
Share this question
or