Lets say I want to set background of all StackPanel in my application to some color. I got the following in my App.xaml:
<Style TargetType="StackPanel">
<Setter Property="Background" Value="#222222" />
</Style>
This will work only if the StackPanel is a pure StackPanel, and the StackPanel must be under the App. However, background color of subclass of StackPanel or StackPanel in a popup dialog will not be changed by this. For example:
public class MyStackPanel : StackPanel { ... }
One way to solve the subclassing problem is to extend UserControl, and embed the StackPanel into the UserControl. This is ok as long as you don't need access to properties of the StackPanel.
Any idea?
What is the best way to do WPF theming?