Reusing themes

4 posts, 0 answers
  1. Gilmar
    Gilmar avatar
    19 posts
    Member since:
    Jul 2010

    Posted 01 Aug 2012 Link to this post

    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
  2. Lancelot
    Lancelot avatar
    251 posts
    Member since:
    Jul 2012

    Posted 01 Aug 2012 Link to this post

    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
  3. Gilmar
    Gilmar avatar
    19 posts
    Member since:
    Jul 2010

    Posted 01 Aug 2012 Link to this post

    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,
  4. Lancelot
    Lancelot avatar
    251 posts
    Member since:
    Jul 2012

    Posted 01 Aug 2012 Link to this post

    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
Back to Top