Search code examples
telerikradpanelbar

Writing Custom Theme for Telerik RadPanelBar.


I am presently writing a custom theme for Telerik RadPanelbar control can anybody had faced this before or know some sort of examples/Sample projects for the same. I dont know the exact approach for it.

So if anyonecan help me out.

Thanks in advance.


Solution

  • I am using Telerik's WPF controls. I needed to have a custom theme for the controls I used in order to make them look like my existing user interface.

    I have created my custom theme based on built-in Metro theme. I have opened the Themes solution provided together with the controls and added a new class into the project named Metro:

    using Telerik.Windows.Controls;
    
    namespace Telerik.Windows.Controls.External
    {
        [ThemeLocation(ThemeLocation.External)]
        public class MetroThemeExternal : Theme
        {
        }
    }
    

    Then I have excluded all xaml files except of Generic.xaml file in the Themes folder and its sub folder Metro. I have included the files that I need to use. In your case you can only have PanelBar.xaml file included into solution. Do not forget to open Generic.xaml and call PanelBar.xaml resource dictionary. You can remove other calls in the Generic.xaml file if you will not use them.

    <ResourceDictionary Source="pack://application:,,,/Telerik.Windows.Themes.Metro;Component/Themes/Metro/PanelBar.xaml"/>
    

    You can modify styles in the PanelBar.xaml as you need and then compile the project. In order to use your theme in your application just set it as follows:

    Telerik.Windows.Controls.StyleManager.ApplicationTheme = new Telerik.Windows.Controls.External.MetroThemeExternal();