开发者

How to apply styles to all windows in WPF app?

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"/>
            <Resou开发者_如何学JAVArceDictionary 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?


You can try very helpful class ThemeManager from http://wpfthemes.codeplex.com. In our project we had similiar problems and solve it by using it.


Figured it out. There were other resources included that were conflicting.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜