protected override bool LookupIsNameScope() { if (UnderlyingType == typeof(ResourceDictionary)) { return(false); } else if (typeof(ResourceDictionary).IsAssignableFrom(UnderlyingType)) { InterfaceMapping map = UnderlyingType.GetInterfaceMap(typeof(System.Windows.Markup.INameScope)); foreach (MethodInfo method in map.TargetMethods) { if (method.Name.Contains("RegisterName")) { return(method.DeclaringType != typeof(ResourceDictionary)); } } return(false); } else { return(base.LookupIsNameScope()); } }