MergedDictionaries nightmare

旧街凉风 提交于 2019-12-14 02:38:43

问题


I'm trying to use a WPF Template and I'm supposed to include this in my App.xaml, but I get "Nested properties are not supported: ResourceDictionaries.MergedDictionaries" error and "The attachable property "MergedDictionaries" was not found in type "ResourceDictionary".

 <Application x:Class="Unico.App"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

                 StartupUri="MainWindow.xaml">
        <Application.Resources>
            <ResourceDictionary.MergedDictionaries>

                <!-- Set default skin -->
                <ResourceDictionary Source="\ExpressionDark.xaml"/>
                <ResourceDictionary Source="\WindowStyle.xaml"/>


            </ResourceDictionary.MergedDictionaries>

            <Style TargetType="{x:Type Rectangle}" />

        </Application.Resources>
    </Application>

I've tried everything but still can't fix this. Any idea? Thanks.


回答1:


MergedDictionaries is a property of ResourceDictionary. Change to:

    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
            ...
            </ResourceDictionary.MergedDictionaries>
            <Style TargetType="{x:Type Rectangle}" />
        </ResourceDictionary>
    </Application.Resources>


来源:https://stackoverflow.com/questions/16498120/mergeddictionaries-nightmare

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!