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

Aligning Buttons in RadToolbar

9 Answers 477 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Chris Boarman
Top achievements
Rank 1
Chris Boarman asked on 08 Jun 2010, 07:56 PM
Hello,

Is there a simple way to right-align a button in the RadToolbar? Frequently, it is nice to have a right-aligned help button or refresh button in a tool bar. I tried setting the HorizontalAlignment property of the contained button to Right, but that didn't work.

9 Answers, 1 is accepted

Sort by
0
Valentin.Stoychev
Telerik team
answered on 14 Jun 2010, 12:25 PM
Hello Chris Boarman,

This is currently not supported. I added your request to the product backlog however we can not stick to any specific date for implementation.

Kind regards,
Valentin.Stoychev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Sypher
Top achievements
Rank 1
answered on 09 Feb 2011, 02:45 AM
woops
0
Petar Mladenov
Telerik team
answered on 11 Feb 2011, 03:40 PM
Hello sypher,

You can vote for this issue here in order to increase its priority.

Kind regards,
Petar Mladenov
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
gans
Top achievements
Rank 1
answered on 08 May 2012, 02:52 AM
We need this feature too. I am surprised we can't do this yet.
0
David
Top achievements
Rank 1
answered on 17 May 2012, 10:58 AM
I need to be able to right align some content in the radtoolbar. * Bump *
0
Ryan
Top achievements
Rank 1
answered on 17 Sep 2015, 05:53 PM
Is this still not available yet?
0
Petar Mladenov
Telerik team
answered on 18 Sep 2015, 05:27 AM
Hi Ryan,

I pleased to let you know that this feature is ready since Q3 2014. Please check out its supporting article and XAML SDK sample in our GitHub Repository.

Regards,
Petar Mladenov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Adrien
Top achievements
Rank 2
answered on 02 Dec 2015, 02:40 PM

Hello,

 is it possible to center-align buttons in a RadToolbar ? I attach a picture of the toolbar I currently have (using "basic" toolbar), but the way I position the buttons doesn't work when the zoom changes. Then, I want to use the RadToolbar to do so.

Thank you, 
Adrien

0
Ivan
Telerik team
answered on 03 Dec 2015, 01:32 PM
Hi Adrien,

The RadToolBar does not support center-alignment of it's items. They can be left-aligned or right-aligned. You can check the Item Alignment article for more information.

However there is a way to solve this situation. You can set margin to the first centered button inside the tool bar. This margin will be dynamically calculated on re-size. Here is an example:
private void RadToolBar_SizeChanged(object sender, SizeChangedEventArgs e)
{
    RadToolBar toolBar = sender as RadToolBar;
    double toolBarWidth = toolBar.ActualWidth;
    var children = toolBar.Items;
    double buttonsTotalWidth = 0;
 
    foreach (Control button in children)
    {
        buttonsTotalWidth += button.ActualWidth;
    }
 
    const double sideConstants = 20;
    double freeSpace = toolBarWidth - buttonsTotalWidth - sideConstants;
    double offset = freeSpace / 2;
 
    ButtonView.Margin = new Thickness(offset, 0, 0, 0);
}
You can check this approach in the sample project attached.

Regards,
Ivan
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
ToolBar
Asked by
Chris Boarman
Top achievements
Rank 1
Answers by
Valentin.Stoychev
Telerik team
Sypher
Top achievements
Rank 1
Petar Mladenov
Telerik team
gans
Top achievements
Rank 1
David
Top achievements
Rank 1
Ryan
Top achievements
Rank 1
Adrien
Top achievements
Rank 2
Ivan
Telerik team
Share this question
or