StretchHorizontally not working?

Thread is closed for posting
2 posts, 0 answers
  1. Marek
    Marek avatar
    48 posts
    Member since:
    Aug 2005

    Posted 23 Jan 2008 Link to this post

    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

  2. Boyko Markov
    Boyko Markov avatar
    610 posts

    Posted 25 Jan 2008 Link to this post

    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 =
    but.TextImageRelation =
    but.ImageAlignment =
    but.TextAlignment =

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

    Boyko Markov
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top