tags:

views:

269

answers:

3

In WPF, where can I put styles that should be applied throughout the application?

This is because currently, whenever I use a style, I put it in the <Window.Resources> section of every window, which ofcourse is wrong in so many ways.

So where can I put these styles to apply throughout?

+5  A: 

<Application.Resources> in your App.xaml

Rich
Excellent, exactly what I was looking for. Thank you
Andreas Grech
A: 

Generally I will create a seperate project called 'LookAndFeel'. This class contains the App.xaml that defines sall of the style that you want your application to use. If you are doing any kind of module based design it is helpful to have this in a seperate project so you can manage the 'look and feel' in one place. In order to leverage this project you will of course need to create a reference to it.

Brette.Net
+3  A: 

If you have many styles it could become bloated with Xaml if you put them all in application.resources. Another possibilty is to use resource dictionaries. Here is more info about resource dictionaries and sharing multiple resource dictionaries.

Crippeoblade