1

我已成功将资源字典(包含我的主题/样式模板资源集合)添加到我的 Window.Resources。这适当地设置了我的每个窗口的样式。但是,当我添加同一行时:

<ResourceDictionary Source="BureauBlack.xaml" x:Key="BureauBlackKey"/>

对我的 App.xaml 来说没有任何变化。

编辑#1:

<Application x:Class="EventPlanner.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:vm="clr-namespace:EventPlanner.ViewModels"
             StartupUri="MainWindow.xaml">
    <Application.Resources>
        <ResourceDictionary>
            <vm:ViewModelLocator x:Key="ViewModelLocatorKey"/>
            <ResourceDictionary Source="BureauBlack.xaml" x:Key="BureauBlackKey"/>
        </ResourceDictionary>
    </Application.Resources>
</Application>
4

1 回答 1

4

您需要将主题资源字典添加到MergedDictionaries集合中:

<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="BureauBlack.xaml" />
        </ResourceDictionary.MergedDictionaries>

        <!-- other resources go here -->

        <vm:ViewModelLocator x:Key="ViewModelLocatorKey"/>

    </ResourceDictionary>
</Application.Resources>
于 2012-05-27T18:27:09.903 回答