How do you apply a built-in theme to the RadDocking?

2 posts, 0 answers
  1. Martin
    Martin avatar
    7 posts
    Member since:
    Sep 2012

    Posted 28 Dec 2012 Link to this post

    We wish to use application wide implicit styling of our application.

    This documentation (http://www.telerik.com/help/wpf/styling-apperance-implicit-styles-overview.html) states that all we have to do is merge in the resources for the selected theme at the application level. We are doing this in code behind since the theme to be used is dependent on settings obtained from the user.

    Adding this to the application's constructor implictly themes all the standard controls in the manner described in the current theming documentation.

             Resources.MergedDictionaries.Add(new ResourceDictionary()
             {
                Source = new Uri("/Telerik.Windows.Themes." + themeName + ";component/Themes/System.Windows.xaml",
                   UriKind.RelativeOrAbsolute)
             });

             Resources.MergedDictionaries.Add(new ResourceDictionary()
             {
                Source = new Uri("/Telerik.Windows.Themes." + themeName + ";component/Themes/Telerik.Windows.Controls.xaml",
                   UriKind.RelativeOrAbsolute)
             });

    However adding this:

             Resources.MergedDictionaries.Add(new ResourceDictionary()
             {
                Source = new Uri("/Telerik.Windows.Themes." + themeName
                   + ";component/Themes/Telerik.Windows.Controls.Navigation.xaml",
                   UriKind.RelativeOrAbsolute)
             });


             Resources.MergedDictionaries.Add(new ResourceDictionary()
             {
                Source = new Uri("/Telerik.Windows.Themes." + themeName
                   + ";component/Themes/Telerik.Windows.Controls.Docking.xaml",
                   UriKind.RelativeOrAbsolute)
             });

    Does not result in any of the docking components being themed.

    Attempting this:

             Resources.MergedDictionaries.Add(new ResourceDictionary()
             {
                Source = new Uri("/Telerik.Windows.Themes." + themeName
                   + ";component/Themes/Telerik.Windows.Documents.xaml",
                   UriKind.RelativeOrAbsolute)
             });

    Results in the exception "Could not load file or assembly Telerik.Windows.Documents" even though the documentation explicitly states that use of this resource is dependent on Telerik.Controls and Telerik.Controls.Input only, (both of which we reference).

    This page (http://www.telerik.com/help/wpf/common-styling-apperance-setting-theme-wpf.html) states that setting an application wide built-in theme will not theme built-in controls, only the RadControls, while this page (http://www.telerik.com/help/wpf/common-styling-themes-mscontrols.html) describes how most of the common built in controls are actually themed as well.

    My impression so far is that the documentation is out-of-date, incomplete and occasionally self-contradictory.

    Using version 2012.3 with C#.

  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 02 Jan 2013 Link to this post

    Hello Martin,

    We are sorry to hear that you had issues with our documentation.

    First regarding the implicit styling:

    In order to merge the Telerik XAML files with code, you should use the following approach:

    Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary()
    {
        Source = new Uri("/Telerik.Windows.Themes." + themeName + ";component/Themes/System.Windows.xaml",
            UriKind.RelativeOrAbsolute)
    });

    In this way the styles will be available for the whole application, not only for the current window.  Y

    I have attached a simple project to demonstrate how you could style RadDocking control with implicit styles. Note that in this case you should use NoXaml assemblies.
     
    As to the Telerik.Windows.Documents.xaml file - it seems that there is some misunderstanding here, please check again the  Applying theme globally in your application section in the article:

    As a general rule of thumb you should merge the xaml files for each assembly reference you have in your project.


    Тhis applies also in the reverse direction -  you should add a reference to Telerik.Windows.Documents.dll in order to merge this XAML file.

    Regarding the last question - we provide Styles for standard MS controls, but you need to manually set them as shown in the code snippet in this article.

    Hope this clears things up.

    Greetings,
    Yana
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top