views:

1192

answers:

3

I am using the RibbonControl from WPF toolkit. It has the Office Blue, Black and Silver themes. But the the theme is not applying for the controls in the window. Is there any solution for that?

I am aplying the theme like

 <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/RibbonControlsLibrary;component/Themes/Office2007Black.xaml"/>
 </ResourceDictionary.MergedDictionaries>

But the controls are like button, textbox are not chaged.

A: 

How are you trying to apply the theme? Are you applying it in your app.xaml (something like the below)?

<ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="/PresentationFramework.Aero,Version=3.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35,ProcessorArchitecture=MSIL;component/themes/aero.normalcolor.xaml" />
    <ResourceDictionary Source="/WPFToolkit;V3.5.31016.1;component/DataGrid/Themes/Aero.NormalColor.xaml" />
</ResourceDictionary.MergedDictionaries>
viggity
+3  A: 

You need a separate resource dictionary to provide WPF styles to various controls. I created my own, by sampling the colors on various apps. It's really not very hard to do, and it olny took me a couple of hours.

If you are looking for a quick and easy solution, try the WPF Themes. The Bureau Blue theme looks pretty much like Office 2007 blue.

David Veeneman
Youy are absolutly right.
Sauron
I have a continued question: After using a WPF theme, how can we reset the theme to the system/OS theme?
Nam Gi VU
A: 

I have been trying to reuse the resources that are defined in the RibbonControlsLibrary.dll so that I can apply a similar styling to the rest of my application. After hours of searching and fiddling, this is what I realised:

<Rectangle Stroke="Black" StrokeThickness="2" RadiusX="6" RadiusY="6" HorizontalAlignment="Stretch" Width="Auto" Grid.RowSpan="3" Grid.ColumnSpan="3"
Fill="{DynamicResource {x:Static r:RibbonSkinResources.RibbonBackgroundBrushKey}}" />

I got the idea by looking at what the keys in the resource dictionary were and looking at this article: http://stackoverflow.com/questions/337803/how-do-i-get-the-actual-resource-from-a-componentresourcekey

This method allows me to create other styles that will have the same look and feel as the selected ribbon skin. Changing the skin will restyle the other aspects of the application, like buttons etc...

Luke Machowski