You are here: Home

View Blog

designer does not support loading dictionaries that mix 'ResourceDictionary'

by Robin Gaschk on Tuesday, 26 March 2013 11:08 PM

After setting up a resource dictionary file I recieved the following error.

The designer does not support loading dictionaries that mix 'ResourceDictionary' items without a key and other items in the same collection. Please ensure that the 'Resources' property does not contain 'ResourceDictionary' items without a key, or that the 'ResourceDictionary' item is the only element in the collection.

Turns out that I had styles defined outside the ResourceDictionary, which was causing the issue.

<ResourceDictionary>
 <ResourceDictionary.MergedDictionaries>
  <ResourceDictionary Source="/xxxx;component/Styles/PageThemes.xaml" />
 </ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
<Style x:Key="DataGridTextColumnStyle" TargetType="TextBlock" >
 <Setter Property="TextWrapping" Value="Wrap" ></Setter>
</Style>

The fix was to have the local Style tag within the ResourceDictionary tag as such:

<ResourceDictionary>
 <ResourceDictionary.MergedDictionaries>
  <ResourceDictionary Source="/xxxx;component/Styles/PageThemes.xaml" />
 </ResourceDictionary.MergedDictionaries>
 <Style x:Key="DataGridTextColumnStyle" TargetType="TextBlock" >
  <Setter Property="TextWrapping" Value="Wrap" ></Setter>
 </Style>
</ResourceDictionary>

Hope this is useful for people. Couldn't find this error anywhere else.

Blogs Parent Separator Robin's Blog
Author
Robin Gaschk

The ramblings of a soapbox man