问题
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