Apply Office 2007 themes for WPF application
Asked Answered
G

3

9

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.

Gangrene answered 30/9, 2009 at 11:16 Comment(0)
H
3

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.

Herriot answered 2/10, 2009 at 16:54 Comment(1)
I have a continued question: After using a WPF theme, how can we reset the theme to the system/OS theme?Ferwerda
M
0

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>
Melanoid answered 30/9, 2009 at 21:48 Comment(0)
M
0

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: 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...

Mormon answered 10/3, 2010 at 11:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.