private EventTriggerHandler(FrameworkElement element, RoutedEvent routedEvent, IEnumerable<ITriggerAction> actions, BaseValueSource valueSource) { this.element = element; this.routedEvent = routedEvent; this.actions = actions; this.valueSource = valueSource; }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { BaseValueSource bvs = ( BaseValueSource )value; string uriPrefix = "/WPFToolkit.Extended;component/PropertyGrid/Images/"; string imageName = "AdvancedProperties11"; switch (bvs) { case BaseValueSource.Inherited: case BaseValueSource.DefaultStyle: case BaseValueSource.ImplicitStyleReference: imageName = "Inheritance11"; break; case BaseValueSource.DefaultStyleTrigger: break; case BaseValueSource.Style: imageName = "Style11"; break; case BaseValueSource.Local: imageName = "Local11"; break; } return(new BitmapImage(new Uri(String.Format("{0}{1}.png", uriPrefix, imageName), UriKind.RelativeOrAbsolute))); }
// Token: 0x060048D9 RID: 18649 RVA: 0x0014AA20 File Offset: 0x00148C20 public static object GetCoercedTransferPropertyValue(DependencyObject baseObject, object baseValue, DependencyProperty baseProperty, DependencyObject parentObject, DependencyProperty parentProperty, DependencyObject grandParentObject, DependencyProperty grandParentProperty) { object result = baseValue; if (DataGridHelper.IsPropertyTransferEnabled(baseObject, baseProperty)) { BaseValueSource baseValueSource = DependencyPropertyHelper.GetValueSource(baseObject, baseProperty).BaseValueSource; if (parentObject != null) { ValueSource valueSource = DependencyPropertyHelper.GetValueSource(parentObject, parentProperty); if (valueSource.BaseValueSource > baseValueSource) { result = parentObject.GetValue(parentProperty); baseValueSource = valueSource.BaseValueSource; } } if (grandParentObject != null) { ValueSource valueSource2 = DependencyPropertyHelper.GetValueSource(grandParentObject, grandParentProperty); if (valueSource2.BaseValueSource > baseValueSource) { result = grandParentObject.GetValue(grandParentProperty); baseValueSource = valueSource2.BaseValueSource; } } } return(result); }
protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e) { base.OnPropertyChanged(e); FrameworkPropertyMetadata metadata = e.Property.GetMetadata(GetType()) as FrameworkPropertyMetadata; if (metadata != null) { if (metadata.AffectsMeasure) { InvalidateMeasure(); } if (metadata.AffectsArrange) { InvalidateArrange(); } } BaseValueSource baseValueSource = GetBaseValueSource(e.Property); if (baseValueSource != BaseValueSource.Default && baseValueSource != BaseValueSource.Inherited) { if (e.OldValue is IInheritableObject) { ((IInheritableObject)e.OldValue).SetInheritanceContext(null); } if (e.NewValue is IInheritableObject) { ((IInheritableObject)e.NewValue).SetInheritanceContext(this); } } }
public void Apply(FrameworkElement target, BaseValueSource valueSource) { INameScope nameScope = valueSource == BaseValueSource.Local ? NameScope.GetContainingNameScope(target) : NameScope.GetTemplateNameScope(target); object layerOwner = valueSource == BaseValueSource.Local ? null : target.TemplatedParent; Begin(target, nameScope, layerOwner); }
private void Clean(FrameworkElement element, BaseValueSource valueSource) { foreach (ITriggerAction action in TriggerActions) { action.Clean(element, valueSource); } }
internal void UpdateAdvanceOptionsForItem(MarkupObject markupObject, DependencyObject dependencyObject, DependencyPropertyDescriptor dpDescriptor, out object tooltip) { tooltip = StringConstants.AdvancedProperties; bool isResource = false; bool isDynamicResource = false; var markupProperty = markupObject.Properties.FirstOrDefault(p => p.Name == PropertyName); if (markupProperty != null) { //TODO: need to find a better way to determine if a StaticResource has been applied to any property not just a style(maybe with StaticResourceExtension) isResource = typeof(Style).IsAssignableFrom(markupProperty.PropertyType); isDynamicResource = typeof(DynamicResourceExtension).IsAssignableFrom(markupProperty.PropertyType); } if (isResource || isDynamicResource) { tooltip = StringConstants.Resource; } else { if ((dependencyObject != null) && (dpDescriptor != null)) { if (BindingOperations.GetBindingExpressionBase(dependencyObject, dpDescriptor.DependencyProperty) != null) { tooltip = StringConstants.Databinding; } else { BaseValueSource bvs = DependencyPropertyHelper .GetValueSource(dependencyObject, dpDescriptor.DependencyProperty) .BaseValueSource; switch (bvs) { case BaseValueSource.Inherited: case BaseValueSource.DefaultStyle: case BaseValueSource.ImplicitStyleReference: tooltip = StringConstants.Inheritance; break; case BaseValueSource.DefaultStyleTrigger: break; case BaseValueSource.Style: tooltip = StringConstants.StyleSetter; break; case BaseValueSource.Local: tooltip = StringConstants.Local; break; } } } } }
public ValueSource(BaseValueSource baseValueSource, bool isExpression, bool isCurrent, bool isAnimated, bool isCoerced) { this.BaseValueSource = baseValueSource; this.IsExpression = isExpression; this.IsCurrent = isCurrent; this.IsAnimated = isAnimated; this.IsCoerced = isCoerced; }
public override void Attach(FrameworkElement element, BaseValueSource valueSource) { IEventTriggerCondition condition = CreateEventTriggerCondition(element); condition.EventRaised += (sender, e) => Apply(element, valueSource); attachedConditions.Add(element, condition); }
public void Attach(FrameworkElement element, BaseValueSource valueSource) { if (Binding == null) { throw new Granular.Exception("DataTrigger.Binding cannot be null"); } handlers.Add(element, new DataTriggerHandler(element, Binding, Value, Setters, valueSource)); }
public override void Apply(FrameworkElement target, BaseValueSource valueSource) { BeginStoryboard beginStoryboard = GetBeginStoryboard(target); if (beginStoryboard != null) { beginStoryboard.Stop(target); } }
internal ValueSource(bool isAnimated, bool isCoerced, bool isExpression, BaseValueSource baseValueSource) { this.isAnimated = isAnimated; this.isCoerced = isCoerced; this.isExpression = isExpression; this.baseValueSource = baseValueSource; }
public void Attach(FrameworkElement element, BaseValueSource valueSource) { if (RoutedEvent == null) { throw new Granular.Exception("EventTrigger.RoutedEvent cannot be null"); } FrameworkElement source = SourceName.IsNullOrEmpty() ? element : (valueSource == BaseValueSource.Local ? NameScope.GetContainingNameScope(element) : NameScope.GetTemplateNameScope(element)).FindName(SourceName) as FrameworkElement; handlers.Add(element, EventTriggerHandler.Register(source, RoutedEvent, Actions, valueSource)); }
internal ValueSource (bool isAnimated, bool isCoerced, bool isExpression, BaseValueSource baseValueSource) { this.isAnimated = isAnimated; this.isCoerced = isCoerced; this.isExpression = isExpression; this.baseValueSource = baseValueSource; }
public override void Apply(FrameworkElement target, BaseValueSource valueSource) { BeginStoryboard beginStoryboard = GetBeginStoryboard(target); if (beginStoryboard != null) { INameScope nameScope = valueSource == BaseValueSource.Local ? NameScope.GetContainingNameScope(target) : NameScope.GetTemplateNameScope(target); object layerOwner = valueSource == BaseValueSource.Local ? null : target.TemplatedParent; beginStoryboard.Remove(target, nameScope, layerOwner); } }
private void OnConditionIsMatchedChanged(FrameworkElement element, BaseValueSource valueSource, bool isMatched) { if (isMatched) { Apply(element, valueSource); } else { Clean(element, valueSource); } }
public InitializeContext(object target, InitializeContext parentContext, INameScope nameScope, FrameworkElement templatedParent, BaseValueSource valueSource) { this.Target = target; this.ParentContext = parentContext; this.NameScope = nameScope; this.TemplatedParent = templatedParent; this.ValueSource = valueSource; this.Root = parentContext != null && parentContext.Root != null ? parentContext.Root : Target; }
public override void Attach(FrameworkElement element, BaseValueSource valueSource) { IDataTriggerCondition condition = CreateDataTriggerCondition(element); condition.IsMatchedChanged += (sender, e) => OnConditionIsMatchedChanged(element, valueSource, condition.IsMatched); if (condition.IsMatched) { Apply(element, valueSource); } attachedConditions.Add(element, condition); }
public override void Detach(FrameworkElement element, BaseValueSource valueSource) { IEventTriggerCondition condition = attachedConditions[element]; Clean(element, valueSource); if (condition is IDisposable) { ((IDisposable)condition).Dispose(); } attachedConditions.Remove(element); }
public void ExitAction(FrameworkElement target, BaseValueSource valueSource) { if (Property == null) { throw new Granular.Exception("Setter.Property cannot be null"); } FrameworkElement resolvedTarget = GetResolvedTarget(target, TargetName, valueSource); DependencyProperty resolvedProperty = Property.GetDependencyProperty(resolvedTarget.GetType()); BaseValueSource resolvedValueSource = GetResolvedValueSource(valueSource, resolvedTarget); resolvedTarget.ClearValue(resolvedProperty, resolvedValueSource); }
protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e) { base.OnPropertyChanged(e); FrameworkPropertyMetadata metadata = e.Property.GetMetadata(GetType()) as FrameworkPropertyMetadata; if (metadata != null) { if (metadata.AffectsMeasure) { InvalidateMeasure(); } if (metadata.AffectsArrange) { InvalidateArrange(); } if (metadata.AffectsRender) { InvalidateVisual(); } if (metadata.AffectsParentMeasure && VisualParent != null) { ((UIElement)VisualParent).InvalidateMeasure(); } if (metadata.AffectsParentArrange && VisualParent != null) { ((UIElement)VisualParent).InvalidateArrange(); } } if (!e.IsSubPropertyChange) { BaseValueSource baseValueSource = GetBaseValueSource(e.Property); if (baseValueSource != BaseValueSource.Default && baseValueSource != BaseValueSource.Inherited) { if (e.OldValue is IContextElement) { ((IContextElement)e.OldValue).TrySetContextParent(null); } if (e.NewValue is IContextElement) { ((IContextElement)e.NewValue).TrySetContextParent(this); } } } }
public void Attach(FrameworkElement element, BaseValueSource valueSource) { if (Property == null) { throw new Granular.Exception("Trigger.Property cannot be null"); } DependencyProperty dependencyProperty = Property.GetDependencyProperty(element.GetType()); object resolvedValue = Value == null || dependencyProperty.PropertyType.IsInstanceOfType(Value) ? Value : TypeConverter.ConvertValue(Value.ToString(), dependencyProperty.PropertyType, XamlNamespaces.Empty); FrameworkElement source = SourceName.IsNullOrEmpty() ? element : NameScope.GetTemplateNameScope(element).FindName(SourceName) as FrameworkElement; handlers.Add(element, TriggerHandler.Register(source, dependencyProperty, resolvedValue, Setters, valueSource)); }
public void EnterAction(FrameworkElement target, BaseValueSource valueSource) { if (Property == null) { throw new Granular.Exception("Setter.Property cannot be null"); } FrameworkElement resolvedTarget = GetResolvedTarget(target, TargetName, valueSource); DependencyProperty resolvedProperty = Property.GetDependencyProperty(resolvedTarget.GetType()); object resolvedValue = Value == null || Value is IExpressionProvider || resolvedProperty.PropertyType.IsInstanceOfType(Value) ? Value : TypeConverter.ConvertValue(Value.ToString(), resolvedProperty.PropertyType, XamlNamespaces.Empty); BaseValueSource resolvedValueSource = GetResolvedValueSource(valueSource, resolvedTarget); resolvedTarget.SetValue(resolvedProperty, resolvedValue, resolvedValueSource); }
internal static Collection <VisualStateGroup> GetVisualStateGroupsInternal(FrameworkElement obj) { if (obj == null) { throw new ArgumentNullException("obj"); } // We don't want to get the default value because it will create/return an empty colleciton. BaseValueSource source = DependencyPropertyHelper.GetValueSource(obj, VisualStateGroupsProperty).BaseValueSource; if (source != BaseValueSource.Default) { return(obj.GetValue(VisualStateManager.VisualStateGroupsProperty) as Collection <VisualStateGroup>); } return(null); }
private static object CoerceCursor(DependencyObject o, object value) { GridSplitter splitter = (GridSplitter)o; BaseValueSource internal2 = DependencyPropertyHelper.GetValueSource(splitter, FrameworkElement.CursorProperty).BaseValueSource; if ((value == null) && (internal2 == BaseValueSource.Default)) { switch (splitter.GetEffectiveResizeDirection()) { case GridResizeDirection.Columns: return(Cursors.SizeWE); case GridResizeDirection.Rows: return(Cursors.SizeNS); } } return(value); }
public ValueSource GetValueSource(DependencyProperty dependencyProperty) { IDependencyPropertyValueEntry entry; if (entries.TryGetValue(dependencyProperty, out entry)) { return(new ValueSource( (BaseValueSource)entry.GetBaseValuePriority(), entry.GetBaseValue(false) is IExpression || entry.GetCurrentValue(false) is IExpression, entry.GetCurrentValue(true) != ObservableValue.UnsetValue, entry.GetAnimationValue(true) != ObservableValue.UnsetValue, (entry is CoercedDependencyPropertyValueEntry) && ((CoercedDependencyPropertyValueEntry)entry).IsCoerced)); } PropertyMetadata propertyMetadata = dependencyProperty.GetMetadata(GetType()); BaseValueSource baseValueSource = propertyMetadata.Inherits && inheritanceParent != null ? BaseValueSource.Inherited : BaseValueSource.Default; return(new ValueSource(baseValueSource, false, false, false, false)); }
public void Clean(FrameworkElement target, BaseValueSource valueSource) { if (Property == null) { throw new Granular.Exception("Setter.Property cannot be null"); } FrameworkElement resolvedTarget = GetResolvedTarget(target, TargetName, valueSource); DependencyProperty resolvedProperty = Property.GetDependencyProperty(resolvedTarget.GetType()); BaseValueSource resolvedValueSource = GetResolvedValueSource(valueSource, resolvedTarget); if (IsStyleValueSource(valueSource)) { resolvedTarget.ClearValue(resolvedProperty, resolvedValueSource); } else { GetInitializedValueOverlapExpression(resolvedTarget, resolvedProperty, resolvedValueSource).ClearValue(this); } }
public void Apply(FrameworkElement target, BaseValueSource valueSource) { if (Property == null) { throw new Granular.Exception("Setter.Property cannot be null"); } FrameworkElement resolvedTarget = GetResolvedTarget(target, TargetName, valueSource); DependencyProperty resolvedProperty = Property.GetDependencyProperty(resolvedTarget.GetType()); object resolvedValue = Value == null || Value is IExpressionProvider || resolvedProperty.PropertyType.IsInstanceOfType(Value) ? Value : TypeConverter.ConvertValue(Value.ToString(), resolvedProperty.PropertyType, XamlNamespaces.Empty); BaseValueSource resolvedValueSource = GetResolvedValueSource(valueSource, resolvedTarget); if (IsStyleValueSource(valueSource)) // no need to use value overlap expression in style setters { resolvedTarget.SetValue(resolvedProperty, resolvedValue, resolvedValueSource); } else { GetInitializedValueOverlapExpression(resolvedTarget, resolvedProperty, resolvedValueSource).SetValue(this, resolvedValue); } }
internal static bool SetIfNonLocal <T>(this DependencyObject o, DependencyProperty property, T value) { Contract.Requires(o != null); Contract.Requires(property != null); if (!property.PropertyType.IsAssignableFrom(typeof(T))) { throw new ArgumentException("Type of dependency property is incompatible with value."); } BaseValueSource source = DependencyPropertyHelper.GetValueSource(o, property).BaseValueSource; if (source != BaseValueSource.Local) { o.SetValue(property, value); return(true); } return(false); }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { BaseValueSource bvs = ( BaseValueSource )value; string toolTip = "Advanced Properties"; switch (bvs) { case BaseValueSource.Inherited: case BaseValueSource.DefaultStyle: case BaseValueSource.ImplicitStyleReference: toolTip = "Inheritance"; break; case BaseValueSource.Style: toolTip = "Style Setter"; break; case BaseValueSource.Local: toolTip = "Local"; break; } return(toolTip); }
internal void UpdateAdvanceOptionsForItem(MarkupObject markupObject, DependencyObject dependencyObject, DependencyPropertyDescriptor dpDescriptor, out string imageName, out object tooltip) { imageName = "AdvancedProperties11"; tooltip = "Advanced Properties"; bool isResource = false; bool isDynamicResource = false; var markupProperty = markupObject.Properties.Where(p => p.Name == PropertyName).FirstOrDefault(); if (markupProperty != null) { //TODO: need to find a better way to determine if a StaticResource has been applied to any property not just a style isResource = (markupProperty.Value is Style); isDynamicResource = (markupProperty.Value is DynamicResourceExtension); } if (isResource || isDynamicResource) { imageName = "Resource11"; tooltip = "Resource"; } else { if ((dependencyObject != null) && (dpDescriptor != null)) { if (BindingOperations.GetBindingExpressionBase(dependencyObject, dpDescriptor.DependencyProperty) != null) { imageName = "Database11"; tooltip = "Databinding"; } else { BaseValueSource bvs = DependencyPropertyHelper .GetValueSource(dependencyObject, dpDescriptor.DependencyProperty) .BaseValueSource; switch (bvs) { case BaseValueSource.Inherited: case BaseValueSource.DefaultStyle: case BaseValueSource.ImplicitStyleReference: imageName = "Inheritance11"; tooltip = "Inheritance"; break; case BaseValueSource.DefaultStyleTrigger: break; case BaseValueSource.Style: imageName = "Style11"; tooltip = "Style Setter"; break; case BaseValueSource.Local: imageName = "Local11"; tooltip = "Local"; break; } } } } }
private static ValueOverlapExpression GetInitializedValueOverlapExpression(FrameworkElement target, DependencyProperty property, BaseValueSource valueSource) { ValueOverlapExpression valueOverlapExpression = target.GetValueEntry(property).GetBaseValue((int)valueSource, false) as ValueOverlapExpression; if (valueOverlapExpression == null) { valueOverlapExpression = new ValueOverlapExpression(); target.SetValue(property, valueOverlapExpression, valueSource); } return valueOverlapExpression; }
public abstract void EnterAction(FrameworkElement target, BaseValueSource valueSource);
private static void AssertValueSource(ValueSource valueSource, bool isCurrent = false, bool isExpression = false, BaseValueSource baseValueSource = BaseValueSource.Local) { Assert.AreEqual(isCurrent, valueSource.IsCurrent); Assert.AreEqual(isExpression, valueSource.IsExpression); Assert.AreEqual(baseValueSource, valueSource.BaseValueSource); }
public void ClearValue(DependencyPropertyKey dependencyPropertyKey, BaseValueSource source = BaseValueSource.Local) { ClearValue(dependencyPropertyKey.DependencyProperty, dependencyPropertyKey, source); }
public void Apply(FrameworkElement target, BaseValueSource valueSource) { ApplyCount++; }
public static IDisposable Register(FrameworkElement element, RoutedEvent routedEvent, IEnumerable<ITriggerAction> actions, BaseValueSource valueSource) { EventTriggerHandler handler = new EventTriggerHandler(element, routedEvent, actions, valueSource); handler.Register(); return handler; }
public void SetValue(object target, object value, BaseValueSource valueSource) { property.SetValue(target, value, index); }
public void SetValue(DependencyPropertyKey dependencyPropertyKey, object value, BaseValueSource source = BaseValueSource.Local) { SetValue(dependencyPropertyKey.DependencyProperty, dependencyPropertyKey, value, source: source); }
public void ExitAction(FrameworkElement target, BaseValueSource valueSource) { target.RemoveHandler(Event, Handler); }
public void EnterAction(FrameworkElement target, BaseValueSource valueSource) { target.AddHandler(Event, Handler, HandledEventsToo); }
public void SetValue(object target, object value, BaseValueSource valueSource) { ((DependencyObject)target).SetValue(property, value, valueSource); }
public override void EnterAction(FrameworkElement target, BaseValueSource valueSource) { BeginStoryboard beginStoryboard = GetBeginStoryboard(target); if (beginStoryboard != null) { beginStoryboard.Stop(target); } }
public void Clean(FrameworkElement target, BaseValueSource valueSource) { ClearCount++; }
private static bool IsStyleValueSource(BaseValueSource valueSource) { return valueSource == BaseValueSource.ThemeStyle || valueSource == BaseValueSource.Style; }
public override void EnterAction(FrameworkElement target, BaseValueSource valueSource) { BeginStoryboard beginStoryboard = GetBeginStoryboard(target); if (beginStoryboard != null) { INameScope nameScope = valueSource == BaseValueSource.Local ? NameScope.GetContainingNameScope(target) : NameScope.GetTemplateNameScope(target); object layerOwner = valueSource == BaseValueSource.Local ? null : target.TemplatedParent; beginStoryboard.Remove(target, nameScope, layerOwner); } }
private void ClearValue(DependencyProperty dependencyProperty, DependencyPropertyKey dependencyPropertyKey, BaseValueSource source) { VerifyReadOnlyProperty(dependencyProperty, dependencyPropertyKey); IDependencyPropertyValueEntry entry; if (!entries.TryGetValue(dependencyProperty, out entry)) { return; } IExpression expression = entry.GetBaseValue((int)source, false) as IExpression; if (expression is IDisposable) { ((IDisposable)expression).Dispose(); } entry.ClearBaseValue((int)source); entry.ClearCurrentValue(); }
private static FrameworkElement GetResolvedTarget(FrameworkElement target, string targetName, BaseValueSource valueSource) { return targetName.IsNullOrEmpty() ? target : (valueSource == BaseValueSource.Local ? NameScope.GetContainingNameScope(target) : NameScope.GetTemplateNameScope(target)).FindName(targetName) as FrameworkElement; }
public abstract void Detach(FrameworkElement element, BaseValueSource valueSource);
private static BaseValueSource GetResolvedValueSource(BaseValueSource valueSource, FrameworkElement target) { return valueSource == BaseValueSource.TemplateTrigger && target.TemplatedParent != null ? BaseValueSource.ParentTemplateTrigger : valueSource; }
public void EnterAction(FrameworkElement target, BaseValueSource valueSource) { INameScope nameScope = valueSource == BaseValueSource.Local ? NameScope.GetContainingNameScope(target) : NameScope.GetTemplateNameScope(target); object layerOwner = valueSource == BaseValueSource.Local ? null : target.TemplatedParent; Begin(target, nameScope, layerOwner); }
private void SetValue(DependencyProperty dependencyProperty, DependencyPropertyKey dependencyPropertyKey, object value, bool setCurrentValue = false, BaseValueSource source = BaseValueSource.Unknown) { VerifyReadOnlyProperty(dependencyProperty, dependencyPropertyKey); IExpressionProvider newExpressionProvider = value as IExpressionProvider; if (newExpressionProvider == null && !dependencyProperty.IsValidValue(value)) { return; // invalid value } IDependencyPropertyValueEntry entry = GetInitializedValueEntry(dependencyProperty); IExpression oldExpression = setCurrentValue ? entry.GetBaseValue(false) as IExpression : // current value may be set in the top priority expression entry.GetBaseValue((int)source, false) as IExpression; if (newExpressionProvider != null) { value = newExpressionProvider.CreateExpression(this, dependencyProperty); } else if (oldExpression != null && oldExpression.SetValue(value)) { return; // value (current or not) was set in the existing expression, nothing else to do } if (setCurrentValue) { entry.SetCurrentValue(value); return; // base value isn't changed } if (oldExpression is IDisposable) // expression is being replaced { ((IDisposable)oldExpression).Dispose(); } entry.SetBaseValue((int)source, value); entry.ClearCurrentValue(); }
internal void UpdateAdvanceOptionsForItem(DependencyObject dependencyObject, DependencyPropertyDescriptor dpDescriptor, out object tooltip) { tooltip = StringConstants.Default; bool isResource = false; bool isDynamicResource = false; //TODO: need to find a better way to determine if a StaticResource has been applied to any property not just a style(maybe with StaticResourceExtension) isResource = typeof(Style).IsAssignableFrom(this.PropertyType); isDynamicResource = typeof(DynamicResourceExtension).IsAssignableFrom(this.PropertyType); if (isResource || isDynamicResource) { tooltip = StringConstants.Resource; } else { if ((dependencyObject != null) && (dpDescriptor != null)) { if (BindingOperations.GetBindingExpressionBase(dependencyObject, dpDescriptor.DependencyProperty) != null) { tooltip = StringConstants.Databinding; } else { BaseValueSource bvs = DependencyPropertyHelper .GetValueSource(dependencyObject, dpDescriptor.DependencyProperty) .BaseValueSource; switch (bvs) { case BaseValueSource.Inherited: case BaseValueSource.DefaultStyle: case BaseValueSource.ImplicitStyleReference: tooltip = StringConstants.Inheritance; break; case BaseValueSource.DefaultStyleTrigger: break; case BaseValueSource.Style: tooltip = StringConstants.StyleSetter; break; case BaseValueSource.Local: tooltip = StringConstants.Local; break; } } } else { // When the Value is diferent from the DefaultValue, use the local icon. if (!object.Equals(this.Value, this.DefaultValue)) { if (this.DefaultValue != null) { tooltip = StringConstants.Local; } else { if (this.PropertyType.IsValueType) { var defaultValue = Activator.CreateInstance(this.PropertyType); // When the Value is diferent from the DefaultValue, use the local icon. if (!object.Equals(this.Value, defaultValue)) { tooltip = StringConstants.Local; } } else { // When the Value is diferent from null, use the local icon. if (this.Value != null) { tooltip = StringConstants.Local; } } } } } } }
public void ExitAction(FrameworkElement target, BaseValueSource valueSource) { // }