How to apply styles to all windows in WPF app?

Posted by Brandon on Stack Overflow See other posts from Stack Overflow or by Brandon
Published on 2010-05-27T03:30:22Z Indexed on 2010/05/27 4:11 UTC
Read the original article Hit count: 378

Filed under:
|
|

I have the following App.xaml file:

<Application x:Class="MiniDeviceConfig.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MiniDeviceConfig.xaml">
<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="Button.xaml"/>
            <ResourceDictionary Source="CheckBox.xaml"/>
            <ResourceDictionary Source="ComboBox.xaml"/>
            <ResourceDictionary Source="Common.xaml"/>
            <ResourceDictionary Source="GroupBox.xaml"/>
            <ResourceDictionary Source="Label.xaml"/>
            <ResourceDictionary Source="LinkButton.xaml"/>
            <ResourceDictionary Source="ListBox.xaml"/>
            <ResourceDictionary Source="ListView.xaml"/>
            <ResourceDictionary Source="RadioButton.xaml"/>
            <ResourceDictionary Source="Tooltip.xaml"/>
            <ResourceDictionary Source="Window.xaml"/>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>

In my application, my main window is MiniDeviceConfig.xaml (as seen above). In my Button.xaml file, I clearly set the button height to some obscene number. And, this size is reflected in my main window's buttons. However, some action on the main window triggers a modal window that has more buttons on it. I was expecting the same tall buttons but no such luck. How do I get the style to propagate into all windows in the application?

© Stack Overflow or respective owner

Related posts about c#

Related posts about wpf