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

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

1 Answer 113 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 28 Dec 2012, 04:27 PM
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#.

1 Answer, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 02 Jan 2013, 02:28 PM
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.

Tags
General Discussions
Asked by
Martin
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or