Change Theme of .NET 4.5 WPF Ribbon
Asked Answered
S

4

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!

Superposition answered 1/11, 2012 at 9:44 Comment(2)
This is related btw, #12511916Temblor
Did you ever figure it out?Signalment
K
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

Kilroy answered 31/1, 2016 at 11:12 Comment(0)
S
-1

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

Sesquioxide answered 1/10, 2015 at 10:46 Comment(0)
D
-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.

Doehne answered 27/8, 2016 at 9:1 Comment(1)
Is this for the .NET 4.5 WPF Ribbon ? The Telerik ribbon is something else.Alimentary
C
-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.

Couture answered 1/11, 2012 at 9:57 Comment(5)
I tried this but it doesn’t work with the Ribbon from .NET 4.5 WPFSuperposition
For that you need a separate resource dictionary to provide WPF styles to various controls. Tell me what exception you are facing exactly.Couture
I don’t have the "RibbonControlsLibrary". I use System.Windows.Controls.Ribbon. I also tried ExpressionDark.xaml and co but they don’t change ribbon colors.Superposition
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.Signalment
This answer is related to RibbonControlsLibrary, not to the .NET 4.5 WPF ribbonColous

© 2022 - 2024 — McMap. All rights reserved.