We use SharedResourceDictionary in our project. The dictionary is built from several posts here on SO. But I reduced it to this:
public class SharedResourceDictionary : ResourceDictionary { public new Uri Source { get { return base.Source; } set { base.Source = value; } } }
In the new VS2015, developed by XAML cannot load styles and complains
1. The resource "..." could not be resolved. 2. Object does not match target type. 3. The resource "..." could not be resolved. 4. The resource "..." could not be resolved. 5. The resource "..." could not be resolved.
in the following markup (the text where he complains is underlined):
<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Style="_1_{StaticResource ...}__" ... > <UserControl.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <utils:SharedResourceDictionary _2_Source="pack://application:,,,/.../Styles.xaml"__ /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </UserControl.Resources> <StackPanel Style="_3_{StaticResource ...}__">
resources and controls are in different assemblies.
Perhaps you are experiencing the same or know the solution?
Refresh . In fact, replacing utils:SharedResourceDictionary only with ResourceDictionary does the job without error.
Update2 : this problem is not due to Styles.xaml - I created an almost empty resource file:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <SolidColorBrush x:Key="Test" Color="#FFFFFF" /> </ResourceDictionary>
and the Visual Studio Design editor just complains the exact same way. And it works if I just replaced utils:SharedResourceDictionary with ResourceDictionary .
Update3 : SharedResourceDictionary is minimalistic, but the XAML editor is still complaining.