private static DependencyProperty RegisterDynamicProperty(DependencyProperty property) { var propertyType = property.GetPropertyType(); return(DependencyPropertyManager.RegisterAttached(GetDynamicPropertyName(property), propertyType, typeof(StyleService), new PropertyMetadata(propertyType.CreateDefaultValue()))); }
public static object GetDefaultValue(Type forType, DependencyProperty dependencyProperty) { var defaultMetadataValue = GetMetadataDefaultValue(forType, dependencyProperty); return(defaultMetadataValue.IsDependencyPropertyUnsetValue() ? dependencyProperty.GetPropertyType().CreateDefaultValue() : defaultMetadataValue); }
public static string GetTypeName(this DependencyProperty dependencyProperty) { return(dependencyProperty.GetPropertyType()?.Name ?? "Unknown"); }