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

Multi-line group button caption

3 Answers 53 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.
Guillaume Crétot Richert
Top achievements
Rank 1
Guillaume Crétot Richert asked on 15 Jan 2009, 09:18 PM
Hi,

I am trying to get the group button's text to display on 2 lines. I've tried setting the Text: UI element's TextWrap property to True, but that did not change anything. I cannot find any other properties that would help me.

What next?

3 Answers, 1 is accepted

Sort by
0
Boyko Markov
Telerik team
answered on 19 Jan 2009, 08:29 AM
Hi Guillaume Crétot Richert,

RadPanelBar group caption does not support the TextWrap feature. I have played with RadPanelBar trying to figure out how to create a workaround. The code I've generated is the following:

Subscribe to the Paint event of the RadPanelBar:
      1. this.radPanelBar1.Paint += new PaintEventHandler(radPanelBar1_Paint);
       
      2. In the event handler I get the group caption bounds and draw directly on it a custom text on the position I want. The sample code draws the text with TopCenter alignment and Red color.

        void radPanelBar1_Paint(object sender, PaintEventArgs e)
        {
            RadPanelBarGroupElement group = (RadPanelBarGroupElement)this.radPanelBar1.Items[0];
            Rectangle captionBounds = group.GetCaptionElement().ControlBoundingRectangle;
        
            StringFormat format = new StringFormat();
            format.LineAlignment = StringAlignment.Near;
            format.Alignment = StringAlignment.Center;
            e.Graphics.DrawString("My Custom String", group.Font, Brushes.Red, captionBounds, format );
        }


We will consider adding the TextWrap feature in a future version of RadPanelBar. I hope this helps you. Do not hesitate to contact me back if you have more questions.

Best wishes,
Boyko Markov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Accepted
Guillaume Crétot Richert
Top achievements
Rank 1
answered on 20 Jan 2009, 02:07 PM
Hi there,

I emulated the wraparound by inserting a VbCrLf in the text displayed at runtime

myRadPanelBarGroupElement.Text = "This text" & vbcrlf & "is wrapped."

Thanks anyway.

Edit: I wish I could mark my own post as the answer. As it is, this thread will remained "unanswered".
0
Nick
Telerik team
answered on 20 Jan 2009, 03:58 PM
Hello Guillaume Crétot Richert,

Thank you for sharing what you found with the community - we have marked your post as an answer.

Do not hesitate to write us back if you have more questions or suggestions.

Regards,
Nick
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Panelbar (obsolete as of Q2 2010)
Asked by
Guillaume Crétot Richert
Top achievements
Rank 1
Answers by
Boyko Markov
Telerik team
Guillaume Crétot Richert
Top achievements
Rank 1
Nick
Telerik team
Share this question
or