private void UpdateBrushFromValueSource() { DependencyPropertyValueSource valueSource = this.AssociatedProperty.ValueSource; if (valueSource.get_IsLocalValue()) { this.DotBrush = (Brush)this.TryFindResource((object)"WhiteBrush"); } else if (valueSource.get_IsInheritedValue() || valueSource.get_IsDefaultValue()) { this.DotBrush = (Brush)this.TryFindResource((object)"PaletteBrush"); } else if (valueSource.get_IsBinding() || valueSource.get_IsTemplateBinding() || valueSource.get_IsCustomMarkupExtension()) { this.DotBrush = (Brush)this.TryFindResource((object)"DatabindingBrush"); } else { if (!valueSource.get_IsResource() && !valueSource.get_IsStatic()) { return; } this.DotBrush = (Brush)this.TryFindResource((object)"ResourceLinkBrush"); } }
protected virtual void SetValueCore(object value) { for (PropertyValue parentValue = this.get_ParentProperty().get_ParentValue(); parentValue != null; parentValue = parentValue.get_ParentProperty().get_ParentValue()) { parentValue.get_ParentProperty(); if (parentValue.get_Source() != DependencyPropertyValueSource.get_LocalValue() && parentValue.get_Source() != DependencyPropertyValueSource.get_InheritedValue() && parentValue.get_Source() != DependencyPropertyValueSource.get_DefaultValue()) { throw new InvalidOperationException(ExceptionStringTable.SettingSubpropertyOfExpression); } } if (value == null && this.property.ShouldClearValueWhenSettingNull) { this.property.ClearValue(); } else { this.property.SetValue(value); } }