/// <summary> /// Samples the default value of the property. /// </summary> /// <param name="property">The property to get the default value for.</param> /// <param name="dependencyProperty">The dependency property to get the value for if a dependency property exists for the property.</param> /// <param name="defaultValueSample">The object to sample the default value from.</param> /// <returns>The default value for the property.</returns> static Object SampleDefault(PropertyInfo property, DependencyProperty dependencyProperty, Object defaultValueSample) { try { if (dependencyProperty != null) { dependencyProperty.GetPropertyDefault(null); } return(defaultValueSample == null ? null : property.GetValue(defaultValueSample)); } catch { return(null); } }