How can I set the style on buttons I add programatically?
I have the toolbar defined like so:
I have the toolbar defined like so:
<toolbar:RadToolbarTray HorizontalAlignment="Left"
x:Name="screenToolbar"
VerticalAlignment="Top"
telerikControls:StyleManager.Theme="Windows7" /> Then I add buttons like this:var button = new Button();tbar.Items.Add(button); //tbar is a toolbar object The buttons don't pick up the style of the tray... on the silverlight side, I explicitly set the style of the button before I add it to the toolbar (app resource), but I don't see a way to pick up the toolbar button styles from the StyleManager... Thanks --
6 Answers, 1 is accepted
0
Hello Chad,
I sent an answer to the support ticket you sent, but I will post it here as well:
If a Telerik theme is applied to a RadToolBar, then all RadToolBar items (including newly added ones) should inherit this theme. However, if a theme is applied to the RadToolBarTray, it won't be applied to its content.
I prepared a sample project illustrating this behavior. Can you please have a look at it and let me know if it works for you. Also, if I am missing something, please modify the sample to reproduce your issue and I will gladly investigate it further.
Greetings,
Tina Stancheva
the Telerik team
I sent an answer to the support ticket you sent, but I will post it here as well:
If a Telerik theme is applied to a RadToolBar, then all RadToolBar items (including newly added ones) should inherit this theme. However, if a theme is applied to the RadToolBarTray, it won't be applied to its content.
I prepared a sample project illustrating this behavior. Can you please have a look at it and let me know if it works for you. Also, if I am missing something, please modify the sample to reproduce your issue and I will gladly investigate it further.
Greetings,
Tina Stancheva
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
Rayne
Top achievements
Rank 1
answered on 30 Nov 2010, 09:31 PM
If I create a userControl with buttons on it and I want to add that userControl to the toolbar, how do I get it to pick up the styles of the toolbar?
0
Hello Rayne,
I posted an answer to your other thread here. Please have a look at it and let me know if you need more info.
Kind regards,
Tina Stancheva
the Telerik team
I posted an answer to your other thread here. Please have a look at it and let me know if you need more info.
Kind regards,
Tina Stancheva
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
Rayne
Top achievements
Rank 1
answered on 03 Dec 2010, 10:13 PM
Thank you.
0
Allen
Top achievements
Rank 2
Iron
Veteran
answered on 19 May 2011, 08:30 PM
Is it not also true that the new button must be a RadButton or it will have to be explicitly styled if generic?
0
Hi Allen,
The RadToolBar has predefined styles for both RadButton and Button (System.Windows.Controls.Button). So you don't need explicit style if you use Button. Please let us know if this is what you are actually asking. Hoe it helped you.
Greetings,
Petar Mladenov
the Telerik team
The RadToolBar has predefined styles for both RadButton and Button (System.Windows.Controls.Button). So you don't need explicit style if you use Button. Please let us know if this is what you are actually asking. Hoe it helped you.
Greetings,
Petar Mladenov
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