private static PropertyReferenceCollection GetPropertyReferenceCollection(object target) { if (!AttachablePropertyServices.TryGetProperty(target, propertyReferencesPropertyID, out PropertyReferenceCollection propertyReferences)) { propertyReferences = new PropertyReferenceCollection(target); AttachablePropertyServices.SetProperty(target, propertyReferencesPropertyID, propertyReferences); } return(propertyReferences); }
public static bool ShouldSerializePropertyReferences(object target) { PropertyReferenceCollection propertyReferences = GetPropertyReferenceCollection(target); return(propertyReferences.Count > 1 || propertyReferences.SingleItem == null); }