14

I am trying to change the theme of the new WPF Ribbon Control from .NET Framework 4.5 and I am stuck.

I only managed to change some brushes (Background, Foreground, Border ...) but I seem to be unable to change the bright overlay and shadows.

I am happy to use a resource dictionary but I don’t know which properties I need to set.

I hope you can point me in the right direction, thank you much for your help!

saluce
  • 13,035
  • 3
  • 50
  • 67
user667967
  • 628
  • 1
  • 8
  • 20

4 Answers4

2

If you want to change anything more than the exposed properties of the Ribbon control (or any other control) e.g. Background, Foreground etc. you will have to edit the control's Template.

In a control's template you can change almost anything that's part of the control's visual appearance.

For more information on customizing a control's template have a look on this link: MSDN Styling & Templating

Striver
  • 451
  • 6
  • 7
-1

For anyone coming across this, you could look at third party controls like: Syncfusion's Ribbon (looks like the office theme)

Aldracor
  • 2,133
  • 1
  • 19
  • 27
-2

it is pretty simple, in your App.xaml you can define a Theme and assign this theme to any control you want. for example I had defined Office_Blue as my theme and assigned this theme only to my Button only as below:

  <Application.Resources>

    <telerik:Theme x:Key="TelerikGlobalTheme">Office_Blue</telerik:Theme>
      <Style BasedOn="{x:Null}" TargetType="{x:Type Button}">
        <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
      </Style>

you can assign as many controls as you want to that defined theme as above.

MohamedHamza
  • 205
  • 1
  • 12
-5

There are two themes as far as I know, one is for "Windows 7(default)" and the other is for "Office 2007 Blue". You can change the theme by adding a resouce dictionay to the window's resouces the source of which is the xaml file of the office 2007 Blue, like following:

<Window.Resources>
    <ResourceDictionary>
      <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary 
          Source="/RibbonControlsLibrary;component/Themes/Office2007Blue.xaml"/>
      </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
  </Window.Resources>

You can copy the Office2007Blue.xaml to a new xaml file and modify it to create a custom theme, then reference it by following the same way as above.

You could get more about Ribbon from here.

And if you want quick and easy solution then try this ready WPF Themes.

saluce
  • 13,035
  • 3
  • 50
  • 67
Bhavik Patel
  • 752
  • 1
  • 5
  • 20
  • 3
    I tried this but **it doesn’t work** with the Ribbon from .NET 4.5 WPF – user667967 Nov 01 '12 at 10:07
  • For that you need a separate resource dictionary to provide WPF styles to various controls. Tell me what exception you are facing exactly. – Bhavik Patel Nov 01 '12 at 10:12
  • 1
    I don’t have the "RibbonControlsLibrary". I use [System.Windows.Controls.Ribbon](http://msdn.microsoft.com/en-us/library/system.windows.controls.ribbon.ribbon.aspx). I also tried ExpressionDark.xaml and co but they don’t change ribbon colors. – user667967 Nov 01 '12 at 10:31
  • Yeah, no clue what this RibbonsControlLibrary is. Is it some third party ribbon control? -- Pretty sure the author and everyone else is just using the built-in Microsoft one. -- I can't figure out how to theme it either. – BrainSlugs83 Jan 25 '15 at 02:25
  • 1
    This answer is related to RibbonControlsLibrary, not to the .NET 4.5 WPF ribbon – Starnuto di topo Dec 24 '15 at 08:21