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

Align RadToolStripElement and/or RadToolStripItem all the way to the right

3 Answers 156 Views
Toolstrip (obsolete as of Q3 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.
E
Top achievements
Rank 1
E asked on 05 Jul 2008, 02:06 AM
Is there any way to align either the RadToolStripElement control or the RadToolStripItem control all the way to the right of its RadToolStrip container?

When using the MS-provided ToolStrip control, it's just a matter of setting the alignment property of a ToolStripItem.

I see there is an "alignment" property exposed for the RadToolStripItem control.  However, changing the property value doesn't really seem to work as I would expect it to.  For example, I have three RadToolStripItems within a RadToolStripElement.  Initially, all three of them had the alignment property set to "MiddleLeft" by default.  Then, I changed the third one's alignment property to "MiddleRight" in hopes that it would do what I was hoping it would.  Unfortunately, it didn't do what I expected.  Instead, the third item is actually showing on top of the second item.  I initially thought perhaps it's due to the ToolStripElement's autosize property having been set to True.  So I set it to False and resized the control to make it bigger but I still can't get the third item to align right.

Is there another property/method for what I am trying to do?



3 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 07 Jul 2008, 02:40 PM
Hello,

RadToolStripElement has a ToolStripElementLayout panel which governs the layout of the child RadToolStripItems. In order to align all items to the right, you should set the Alignment property of this panel as follows:
this.radToolStrip1.Items[0].Children[0].Alignment = ContentAlignment.MiddleRight; 

Unfortunately we found an issue that currently does not allow you to right-align a single RadToolStripItem. This will be addressed in one of our next releases.

If you have additional questions, feel free to contact me.

Best wishes,
Nikolay
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Dan Wons
Top achievements
Rank 1
answered on 07 Jul 2008, 11:27 PM
Thanks for the reply.  Your suggestion sort of worked -- at least now I have my RadToolStripItems aligned to the right within the RadToolStripElement.  However, here's where I am having trouble.  I realized I couldn't just have one RadToolStripElement and have some items aligned to the left and some items aligned to the right like I can with the standard ToolStrip control that comes with Visual Studio.  So I added two RadToolStripElements to my RadToolStrip in hopes that I would have all items in one RTSElement aligned to the left and all items in the other RTSElement aligned to the right and basically make them look somehting like as follows:

--------------------------------------------------------------------
| btn_1 | btn_2 | btn_3                                              btn_4 | btn_5 |
--------------------------------------------------------------------

The problem is that I can't get my 2nd RTSElement to align to the right.  When I change the alignment property, it exhibits really strange behaviors.  For example, the 2nd RTSElement appears in random location within the tool strip control.  Worse yet, it also hides/shows btn_4 and btn_5 randomly.  Furthermore, it crashes my Visual Studio if I change the property a few times.  I thought it was just my dev box at work so I tried from home and same thing happens.

Is what I am trying to accomplish impossible using the current release?  If it is, I need to switch to using a different control fast. 

Thanks.
0
Nikolay
Telerik team
answered on 10 Jul 2008, 09:24 AM
Hello Dan Wons,

Currently, the scenario where you have RadToolStripItem aligned to the left and another RadToolStripItem aligned to the right is not supported out of the box. I can suggest two workarounds which will suit your needs.

I. The first one is:
  1. Add a ToolStripElementLayout panel to the RadToolStripElement.
  2. Create a RadToolStripItem
  3. Create several button elements and add them to the RadToolStripItem.
  4. Add the RadToolStripItem to the ToolStripElementLayout panel.

II. The second one is:

  1. Generally, RadToolStripElements are represented as rows and the StripLayoutPanel, which contains them is with Orientation property set to Vertical. You need to set this Orientation to Horizontal.
  2. You should also set the appropriate MaxSizes to the RadToolStripElements. Otherwise, only the first RadToolStripElement will be visible.

Please note, that since these are workarounds, the dragging functionality of the RadToolStripItems may not behave correctly. In addition, when you are making your RadToolStrip small in size and hence not enough to show the whole content, the layout you observe may not be the correct one. I have attached two sample projects to demonstrate the approaches above.

Regarding the issues you encounter, please send me a sample project in the support ticket you have opened. Please provide steps, which will help me to reproduce the issues. This will allow me to address them further.

If you have additional questions, feel free to contact me.

Regards,
Nikolay
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Toolstrip (obsolete as of Q3 2010)
Asked by
E
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Dan Wons
Top achievements
Rank 1
Share this question
or