主题\Generic.xaml:
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="WPF Commons;component/Controls/Layout/Foo/FooItem.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
控件\布局\Foo\FooItem.xaml:
<Style TargetType="{x:Type l:FooItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type l:FooItem}">
<Border>
<ContentPresenter ContentSource="Header" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
如果我将整个样式复制到我的用户控件资源中,它可以正常工作。但如果不这样做,则用户控件将显示为空。在Expression Blend 4中,我右键单击并选择编辑模板
,但它不会让我选择编辑副本...
,这让我认为出现了严重的问题,Generic.xaml没有正确加载。我猜测是因为 Generic.xaml 的问题,因为如果我删除 MergedDictionary 调用并将 xaml 样式直接复制粘贴到 Generic.xaml 中,它仍然无法工作。