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

Reusing themes

3 Answers 61 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Gilmar
Top achievements
Rank 1
Gilmar asked on 01 Aug 2012, 05:36 PM
My Silverlight application provides all the themes to be used by the user through a selection of themes.

How do I create a new silverlight control in which for example would use the backgroud of a RadWindow, the border color of a RadButton, etc...

Existing these styles within the Telerik themes, I could reuse them for use in new controls? or would have to create a new style for each subject pre-existing?

What would be the correct way to create new Silverlight Controls using telerik all themes?

tks

3 Answers, 1 is accepted

Sort by
0
Lancelot
Top achievements
Rank 1
answered on 01 Aug 2012, 09:04 PM
Hi Gilmar,

You can set your entire application to use the themes instead of individual controls or pages. To do this, you instantiate the theming mechanism in your App.xaml.cs file.

To learn more on how to do this, go to this link. The documentation wills how you how to set the theme in four different ways. The one you want is the "Application-wide" section.

If you look over to the left pane, you'll see other documentation about Styling and Appearance of the RadControls for Silverlight. The expanded node contains other sections on setting a themes.

Good luck,
Lancelot
0
Gilmar
Top achievements
Rank 1
answered on 01 Aug 2012, 09:35 PM
I think you did not understand me.

My application already uses "StyleManager.ApplicationTheme = new MetroTheme();" in App.xaml.cs
I already use several controls "RadControls" in my application.

I want to create new controls (non-existent in RadControls) using the color patterns that are active in "StyleManager.ApplicationTheme."

For example: I want to create a control that has a "rectangle" with the background color of a "RadButton" and border color of the border "RadMaskedTextBox."

Something like:
            Style style = StyleManager.ApplicationTheme.GetStyle("RadButton");
            Brush brush = style.GetSetter("Background");
            MyControl control.Background = brush;

tks,
0
Lancelot
Top achievements
Rank 1
answered on 01 Aug 2012, 09:41 PM
Hi Gilmar,

Yes it is possible. See this documentation to learn how to do it. However, this may not work for all the SL controls and Telerik states as much before providing the example code. This is a list of the controls they state it will work with:
  • System.Windows.Button
  • System.Windows.ListBox
  • System.Windows.RadioButton
  • System.Windows.ScrollViewer
  • System.Windows.PasswordBox
  • System.Windows.RepeatButton
  • System.Windows.TextBox

Good luck!
Lancelot
Tags
General Discussions
Asked by
Gilmar
Top achievements
Rank 1
Answers by
Lancelot
Top achievements
Rank 1
Gilmar
Top achievements
Rank 1
Share this question
or