How to change default window theme

6 posts, 1 answers
  1. Ivan Kopcanski
    Ivan Kopcanski avatar
    47 posts
    Member since:
    Jul 2009

    Posted 07 May 2010 Link to this post

    Hello, I've tried to change the window theme on the inherited RadWindow on several ways:

    1.) In XAML itself:
    <base:WindowBase x:Class="ListScreenView"
        xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"
        telerik:Theming.Theme="Windows7" ...>
    or 
        telerik:StyleManager.Theme="Windows7" ..>

    2.) in code-behind:
    class ListScreenView : WindowBase
    {
    public ListScreenView()
            {
                InitializeComponent();

                Theme theme = ThemeManager.FromName("Windows7");
                StyleManager.SetTheme(this, theme);
            }
    ...
    }

    3.) On application level by:
         StyleManager.ApplicationTheme = ThemeManager.FromName("Windows7"); 

    And none of this works. Window keeps the default theme other than Windows 7 one. 
    I wish to be able to change the window border style by changing the theme on the window.
    Can you please assist me on this issue? 
  2. Answer
    Ross Wozniak
    Ross Wozniak avatar
    6 posts
    Member since:
    Jan 2010

    Posted 07 May 2010 Link to this post

    Hi Ivan,

    Have you included a reference to the Telerik.Windows.Themes.Windows7.dll in your project?

    Ross
  3. DevCraft banner
  4. Ivan Kopcanski
    Ivan Kopcanski avatar
    47 posts
    Member since:
    Jul 2009

    Posted 11 May 2010 Link to this post

    Hi, Ross,

        The Telerik.Windows.Themes.Windows7 assembly reference was missing in the project. 
    The window was shown with related theme applied in XAML, but the window behaved strange.
    The properties that have been applied in style before did not work after setting the theme.
    These properties started to work after they are moved from style directly to the window itself.
    One of these properties are WindowStartupLocation, Width and Height

    It seems to me that the settings have their priority: 

    1.) Some properties (not all of them) in XAML itself have the highest priority,
    2.) Then the theme properties are forced,
    3.) The properties in styles have the lowest priority.

      I'm asking myself am I right. Can you clarify that if you know the cause? 

          
  5. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 11 May 2010 Link to this post

    Hi Ivan,

     Setting the theme actually sets a style to the Window and this is the reason why the Theme overrides your style - it is set after the style.

    All the best,
    Miroslav Nedyalkov
    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.
  6. Ivan Kopcanski
    Ivan Kopcanski avatar
    47 posts
    Member since:
    Jul 2009

    Posted 12 May 2010 Link to this post

    Have the Telerik SL controls been affected by some 'default' theme, if no theme is set either on app. level or control level explicitly?
    If this is the true there are only two possibilities to force my own styles:

    1.) Extract and edit controls template
    2.) Create custom theme XAML file and apply it to some or all of Telerik controls.

    Is there any easier solution?

  7. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 15 May 2010 Link to this post

    Hello Ivan,

     The application themes are set in a deferent manner. Only themes, set directly to a control act the way I describled.

    Greetings,
    Miroslav Nedyalkov
    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.
Back to Top
DevCraft banner