0

I'm trying to theme my WPF app to look like...a normal desktop app.

I've seen other questions answered asking basically the same thing, but the solution doesn't seem to work for me. Suppose my menu bar is defined in XAML like so:

<DockPanel>
    <Menu DockPanel.Dock="Top"
          Background="{DynamicResource {x:Static SystemColors.MenuBarBrushKey}}" />
</DockPanel>

(In actuality it also contains MenuItem entries, etc.) Running it on Windows 10---with no changes from the default theme---my menu bar is a grayish #f0f0f0 color. If I launch other (non-metro) apps, such as Notepad, Notepad++, Evernote, Maple, Snipping Tool, and so on, the menu bar is white: #ffffff.

Can someone point me in the correct direction for correctly using the Windows system colors?

Zac
  • 876
  • 1
  • 8
  • 18
  • Do you have a Metro/UWP or Win32 app? – Lennart Nov 15 '16 at 08:14
  • What? A standard WPF application is a desktop application. Why should it look different than the default theme? – Clemens Nov 15 '16 at 08:14
  • I'm trying to achieve the default theme color. Every other desktop application has a white menu bar, but when I use this code (and when I don't specify `Background` at all) my menu bar is gray. I don't want to make the menu bar explicitly white, because that does not adapt to user theme changes. – Zac Nov 15 '16 at 08:25

2 Answers2

0

WPF is a very customisable UI framework. By default, it doesn't really come 'themed' and the default looks pretty bad (opinion), but you are free to create any styles you want to adjust the look and feel of your application.

You need to either create styled controls for your application yourself, use some styles already created or build on top of a UI styling framework.

Windows 7 theme for WPF?

A codeplex containing a lot of free themes: http://wpfthemes.codeplex.com/

Alternatively, you could build on top of a styling/theming framework. One that I have used before and would recommend is MahApps Metro - it is a tool kit that can be used to make metro styled apps, the default styles look pretty awesome and there are a lot of already revamped/custom controls. You can easily override styles from that library to create your own look. It also uses two base color schemes that are used throughout, allowing a very consistent and customisable feel throughout the application. There are alternative frameworks out there, but the ones I've found are mostly for 'Metro' themes.

Modern UI for WPF

Elysium

Community
  • 1
  • 1
MaxJ
  • 1,945
  • 2
  • 12
  • 19
-1

You need a SystemColors class. And a good article of it's usage: SystemColors Reference. Have a nice read :)

Shakra
  • 501
  • 2
  • 8
  • My question explicitly shows me using `SystemColors` and I emphasize that I am not getting menu bar colors consistent with other desktop apps. – Zac Nov 15 '16 at 20:52