public void CoerceValue(DependencyProperty dp) { PropertyMetadata pm = dp.GetMetadata(this); if (pm.CoerceValueCallback != null) { pm.CoerceValueCallback(this, this.GetValue(dp)); } }
private object GetDefaultValue(DependencyProperty dp) { PropertyMetadata metadata = dp.GetMetadata(this); FrameworkPropertyMetadata frameworkMetadata = metadata as FrameworkPropertyMetadata; object result = metadata.DefaultValue; if (frameworkMetadata != null && frameworkMetadata.Inherits) { if (this.dependencyParent != null) { result = this.dependencyParent.GetValue(dp); } } return(result); }
private void SetValueInternal(DependencyProperty dp, object oldValue, object newValue) { PropertyMetadata metadata = dp.GetMetadata(this); if (metadata.CoerceValueCallback != null) { newValue = metadata.CoerceValueCallback(this, newValue); } if (newValue != DependencyProperty.UnsetValue && dp.IsValidValue(newValue)) { this.properties[dp] = newValue; } else { this.properties.Remove(dp); newValue = this.GetValue(dp); } if (!this.AreEqual(oldValue, newValue)) { this.OnPropertyChanged(new DependencyPropertyChangedEventArgs(dp, oldValue, newValue)); } }
private void SetValueInternal(DependencyProperty dp, object oldValue, object newValue) { PropertyMetadata metadata = dp.GetMetadata(this); if (metadata.CoerceValueCallback != null) { newValue = metadata.CoerceValueCallback(this, newValue); } if (newValue != DependencyProperty.UnsetValue && dp.IsValidValue(newValue)) { this.properties[dp] = newValue; } else { this.properties.Remove(dp); newValue = this.GetValue(dp); } if (!this.AreEqual(oldValue, newValue)) { this.OnPropertyChanged(new DependencyPropertyChangedEventArgs(dp, oldValue, newValue)); } }
private object GetDefaultValue(DependencyProperty dp) { PropertyMetadata metadata = dp.GetMetadata(this); FrameworkPropertyMetadata frameworkMetadata = metadata as FrameworkPropertyMetadata; object result = metadata.DefaultValue; if (frameworkMetadata != null && frameworkMetadata.Inherits) { if (this.dependencyParent != null) { result = this.dependencyParent.GetValue(dp); } } return result; }
public void CoerceValue(DependencyProperty dp) { PropertyMetadata pm = dp.GetMetadata(this); if (pm.CoerceValueCallback != null) { pm.CoerceValueCallback(this, this.GetValue(dp)); } }