Frage

I've successfully added a resource dictionary (containing my theme/collection of styles template resources) to my Window.Resources. This styles each of my windows appropriately. However, when I add the same line:

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

To my App.xaml nothing changes.

Edit #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>
War es hilfreich?

Lösung

You need to add the theme resource dictionary to the MergedDictionaries collection:

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

        <!-- other resources go here -->

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

    </ResourceDictionary>
</Application.Resources>
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top