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

UserControl styling in RadToolBar

1 Answer 93 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 07 Sep 2011, 09:38 PM
When I place a custom UserControl (which contains a TextBox and a RadButton) in a RadToolBar, how can I get the controls inside my UserControl to take on the re-styling that normally occurs when placing those controls directly into a toolbar?  I found this forum post:

http://www.telerik.com/community/forums/silverlight/toolbar/text-box-or-custom-control-in-tool-bar.aspx

which provides an great example of how to apply a custom style for a custom control in a RadToolBar, but that's not what I'm looking for. How can I get the RadToolBar to re-style the individual elements of my custom control?

1 Answer, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 08 Sep 2011, 11:19 AM
Hi Jon,

The RadToolBar controls has a predefined ItemContainerStyleSelector that sets default styles to the following types of elements:RadToolBarSeparator, TextBlock, TextBox, Button, ToggleButton, CheckBox, RadioButton, RadButton, RadToggleButton, RadRadioButton, RadDropDownButton, RadSplitButton.

However, the ItemContainerStyleSelector can only be applied to direct children of the listed types and since in your case, the TextBox and RadButton are wrapped in another control before added to the RadToolBar you'll need to define a custom style for them. I attached a sample project that contains the predefined styles for the RadToolBar and its children. I also added a custom control with a TextBox and RadButton and I copied the RadToolBar TextBox and RadButton predefined styles and I applied it to the controls in the CustomControl. Please have a look at the solution and let me know if it helps.

Best wishes,
Tina Stancheva
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
ToolBar
Asked by
Jon
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Share this question
or