The type of the given object must be FrameworkElement, FrameworkContentElement or INameScope (except for ResourceDictionary) ...