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

StretchHorizontally not working?

1 Answer 39 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.
Marek
Top achievements
Rank 1
Marek asked on 23 Jan 2008, 05:11 PM
Hi
I'm not sure whether it is the way I am using the control or whether it is the control itself.

I have a panel bar with a few groups and the first group has a few image button elements.  I then wish to have the text shown below a 32x32 image.  The text and image should appear aligned in the middle of the panel bar.  I have tried setting the image directly or via an image list, but I still have the same problems (please see below).

The stretch horizontally style seems to be getting reset randomly in the design time and when I do get it to "stick", I do not get the items stretched horizontally at runtime.  I then unpredictably lose the other settings such as the image, its position relative to the text, the display style etc.  At the moment the control is not at all usable for our purpose.

Please could you advise.

Best regards

Marek

1 Answer, 1 is accepted

Sort by
0
Boyko Markov
Telerik team
answered on 25 Jan 2008, 01:04 PM
Hello Marek,

I reproduced the issue with the designtime behavior you are experiencing.

The workaround I can suggest is to add your code through the API in the application's form constructor after the InitializeComponent method call. Here is sample code which is setting a few properties of RadButtonElement which are chldren of RadPanelBarGroupElement:

for (int i = 0; i < this.radPanelBarGroupElement6.Items.Count; i++)
{
RadButtonElement but = this.radPanelBarGroupElement6.Items[i] as RadButtonElement;
if (but != null)
{
but.ImageIndex = 0;
but.StretchHorizontally =
true;
but.TextImageRelation =
TextImageRelation.ImageAboveText;
but.ImageAlignment =
ContentAlignment.MiddleCenter;
but.TextAlignment =
ContentAlignment.MiddleCenter;
}
}


I hope this helps. If you have any questions, please contact us again.

Greetings,
Boyko Markov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Panelbar (obsolete as of Q2 2010)
Asked by
Marek
Top achievements
Rank 1
Answers by
Boyko Markov
Telerik team
Share this question
or