This project has moved and is read-only. For the latest updates, please go here.

Dynamically change theme of PropertyGrid

Jan 28, 2014 at 9:14 PM
Hello, I'm newbie who experements with themes of app for job-interview:)

I dynamically change themes for the Propertygrid. I modified default theme in PropertyGrid/Generics.xaml for it by changing color and placed it to run-time theme file. But property name and grid of items still have default color. How to do it?

I tried to change colors for another controls(combobox, textbox), but it gave no success for vision of PropertyGrid. I see changes of colors only for checkbox.
Developer
Jan 30, 2014 at 1:46 PM
Hi,

If you want to change the theme of the PropertyGrid, you will have to modify 1 of the following files :
-Xceed.Wpf.Toolkit/PropertyGrid/Themes/Aero2.NormalColor.xaml (in Windows8)
-Xceed.Wpf.Toolkit/PropertyGrid/Themes/Generic.xaml (in Windows7)

Then, just using a PropertyGrid should apply these default themes.
May 5, 2014 at 10:29 AM
I can set theme in my xaml for Avalon dock. Is it possible to do the same for the PropertyGrid?

<avalonDock:DockingManager>
        <avalonDock:DockingManager.Theme>
            <darkMetro:MetroTheme/>
        </avalonDock:DockingManager.Theme>
        <avalonDock:LayoutRoot>
.........
....

Here application will always load MetroTheme, overriding default theme which depends on window. How can I achieve this for PropertyGrid,
Developer
May 5, 2014 at 1:19 PM
Hi,

If you want to use 1 of the predefined themes(Office2007 Blue, Office2007 Black, Office2007 Silver, Metro Dark, Metro Light) for any controls of the toolkit, you need to load the corresponding ressourceDictionary like this :
xmlns:office="clr-namespace:Xceed.Wpf.Toolkit.Themes.Office2007;assembly=Xceed.Wpf.Toolkit.Themes.Office2007"

<Window.Resources>
      <ResourceDictionary>
         <ResourceDictionary.MergedDictionaries>
            <office:Office2007BlueResourceDictionary />
         </ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

or in Code-behind :
this.Resources.MergedDictionaries.Add( new Xceed.Wpf.Toolkit.Themes.Office2007.Office2007BlueResourceDictionary() );
And all your Toolkit controls will be themed!

Please note that those themes are only available in the Plus Version of the Toolkit (http://xceed.com/Extended_WPF_Toolkit_Features.html).
For AvalonDock, there are 3 themes available in the Community Edition of the Toolkit (Metro, Aero and VS2010). The Plus version of the Toolkit includes those 3 themes + (Office2007 Blue, Office2007 Black, Office2007 Silver, Metro Dark, Metro Light).