/// <summary> /// Clears the local value of a property /// </summary> public void ClearValue(DependencyProperty dp) { INTERNAL_PropertyStorage storage; if (INTERNAL_PropertyStore.TryGetStorage(this, dp, false /*don't create*/, out storage)) { INTERNAL_PropertyStore.ClearValueCommon(storage); } }
/// <summary> /// Sets the inherited value of a dependency property on a DependencyObject. Do not use this method. /// </summary> /// <param name="dependencyProperty">The identifier of the dependency property to set.</param> /// <param name="value">The new local value.</param> /// <param name="recursively">Specifies if the inherited value must be applied to the children of this DependencyObject.</param> public void SetInheritedValue(DependencyProperty dependencyProperty, object value, bool recursively) { //----------------------- // CALL "SET INHERITED VALUE" ON THE STORAGE: //----------------------- var storage = INTERNAL_PropertyStore.GetInheritedPropertyStorage(this, dependencyProperty, createAndSaveNewStorageIfNotExists: true); INTERNAL_PropertyStore.SetInheritedValue(storage, value, recursively); }
/// <summary> /// Sets a value that states that the visuals do not reflect the value of the Dependency in C#, so the visuals should be updated even if the value doesn't change the next time it is set. /// </summary> /// <param name="dp">The DependencyProperty that needs its visual's equivalents refreshed.</param> internal void DirtyVisualValue(DependencyProperty dp) { INTERNAL_PropertyStorage storage; if (INTERNAL_PropertyStore.TryGetStorage(this, dp, true /*create if not found*/, out storage)) { INTERNAL_PropertyStore.DirtyVisualValue(storage); } }
/// <summary> /// Sets the inherited value of a dependency property on a DependencyObject. Do not use this method. /// </summary> /// <param name="dependencyProperty">The identifier of the dependency property to set.</param> /// <param name="value">The new local value.</param> /// <param name="recursively">Specifies if the inherited value must be applied to the children of this DependencyObject.</param> public void SetInheritedValue(DependencyProperty dependencyProperty, object value, bool recursively) { //----------------------- // CALL "SET INHERITED VALUE" ON THE STORAGE: //----------------------- var storage = INTERNAL_PropertyStore.GetInheritedPropertyStorageOrCreateNewIfNotFound(this, dependencyProperty); INTERNAL_PropertyStore.SetInheritedValue(storage, value, recursively); }
internal void SetLocalStyleValue(DependencyProperty dp, object value) { INTERNAL_PropertyStorage storage; if (INTERNAL_PropertyStore.TryGetStorage(this, dp, value != DependencyProperty.UnsetValue /*create*/, out storage)) { INTERNAL_PropertyStore.SetLocalStyleValue(storage, value); } }
/// <summary> /// Returns the current effective value of a dependency property from a DependencyObject. /// </summary> /// <param name="dependencyProperty"> /// The DependencyProperty identifier of the property for which to retrieve the /// value. /// </param> /// <returns>Returns the current effective value.</returns> public object GetValue(DependencyProperty dependencyProperty) { INTERNAL_PropertyStorage storage; if (INTERNAL_PropertyStore.TryGetStorage(this, dependencyProperty, false /*don't create*/, out storage)) { return(INTERNAL_PropertyStore.GetEffectiveValue(storage)); } return(dependencyProperty.GetTypeMetaData(this.GetType()).DefaultValue); }
// This method is here to workaround the fact that in Silverlight, ReadLocalValue() // can return a value set from a style if it is a BindingExpression, while in WPF // ReadLocalValue() will only return the local value internal object ReadLocalValueInternal(DependencyProperty dp) { INTERNAL_PropertyStorage storage; if (INTERNAL_PropertyStore.TryGetStorage(this, dp, false /*don't create*/, out storage)) { return(storage.LocalValue); } return(DependencyProperty.UnsetValue); }
/// <summary> /// Sets the inherited value of a dependency property on a DependencyObject. Do not use this method. /// </summary> /// <param name="dp">The identifier of the dependency property to set.</param> /// <param name="value">The new local value.</param> /// <param name="recursively">Specifies if the inherited value must be applied to the children of this DependencyObject.</param> internal void SetInheritedValue(DependencyProperty dp, object value, bool recursively) { //----------------------- // CALL "SET INHERITED VALUE" ON THE STORAGE: //----------------------- INTERNAL_PropertyStorage storage; INTERNAL_PropertyStore.TryGetInheritedPropertyStorage(this, dp, true /*create*/, out storage); INTERNAL_PropertyStore.SetInheritedValue(storage, value, recursively); }
public object GetAnimationValue(DependencyProperty dependencyProperty) { if (dependencyProperty == null) { throw new ArgumentNullException("No property specified"); } var storage = INTERNAL_PropertyStore.GetStorage(this, dependencyProperty, createAndSaveNewStorageIfNotExists: true); return(INTERNAL_PropertyStore.GetValue(storage)); }
public void SetAnimationValue(DependencyProperty dependencyProperty, object value) { if (dependencyProperty == null) { throw new ArgumentNullException("No property specified"); } var storage = INTERNAL_PropertyStore.GetStorageOrCreateNewIfNotExists(this, dependencyProperty); INTERNAL_PropertyStore.SetSpecificValue(storage, KindOfValue.Animated, value); }
/// <summary> /// Sets the local value of a dependency property on a DependencyObject while not overriding a hypothetical Binding (example: when the user writes in a TextBox with a two way Binding on its Text property). /// </summary> /// <param name="dependencyProperty">The identifier of the dependency property to set.</param> /// <param name="value">The new local value.</param> public void SetLocalValue(DependencyProperty dependencyProperty, object value) { #if PERFSTAT var t = Performance.now(); #endif var storage = INTERNAL_PropertyStore.GetStorageOrCreateNewIfNotExists(this, dependencyProperty); #if PERFSTAT Performance.Counter("DependencyObject.SetLocalValue", t); #endif INTERNAL_PropertyStore.SetSpecificValue(storage, KindOfValue.Local, value); }
internal void StyleSetterValueChanged(object sender, RoutedEventArgs e) { Setter setter = (Setter)sender; if (setter.Property != null) // Note: it can be null for example in the XAML text editor during design time, because the "DependencyPropertyConverter" class returns "null". { INTERNAL_PropertyStorage storage = INTERNAL_PropertyStore.GetStorageOrCreateNewIfNotExists(this, setter.Property); HashSet2 <Style> stylesAlreadyVisited = new HashSet2 <Style>(); // Note: "stylesAlreadyVisited" is here to prevent an infinite recursion. INTERNAL_PropertyStore.SetLocalStyleValue(storage, Style.GetActiveValue(setter.Property, stylesAlreadyVisited)); } }
/// <summary> /// Sets the local value of a dependency property on a DependencyObject while not overriding a hypothetical Binding (example: when the user writes in a TextBox with a two way Binding on its Text property). /// </summary> /// <param name="dependencyProperty">The identifier of the dependency property to set.</param> /// <param name="value">The new local value.</param> public void SetLocalValue(DependencyProperty dependencyProperty, object value) { #if PERFSTAT var t = Performance.now(); #endif var storage = INTERNAL_PropertyStore.GetStorage(this, dependencyProperty, createAndSaveNewStorageIfNotExists: true); #if PERFSTAT Performance.Counter("DependencyObject.SetLocalValue", t); #endif INTERNAL_PropertyStore.SetLocalValue(storage, value); }
internal void StyleSetterValueChanged(object sender, RoutedEventArgs e) { Setter setter = (Setter)sender; if (setter.Property != null) // Note: it can be null for example in the XAML text editor during design time, because the "DependencyPropertyConverter" class returns "null". { INTERNAL_PropertyStorage storage = INTERNAL_PropertyStore.GetStorage(this, setter.Property, createAndSaveNewStorageIfNotExists: true); //the createAndSaveNewStorageIfNotExists's value should have no actual meaning here because the PropertyStorage should have been created when applying the style. HashSet2 <Style> stylesAlreadyVisited = new HashSet2 <Style>(); // Note: "stylesAlreadyVisited" is here to prevent an infinite recursion. INTERNAL_PropertyStore.SetLocalStyleValue(storage, Style.GetActiveValue(setter.Property, stylesAlreadyVisited)); } }
public object GetVisualStateValue(DependencyProperty dependencyProperty) //todo: see if this is actually useful (to get specifically the VisualStateValue) and if so, change the GetValue into a GetVisualStateValue at the "return" line. { if (dependencyProperty == null) { throw new ArgumentNullException("No property specified"); } var storage = INTERNAL_PropertyStore.GetStorage(this, dependencyProperty, createAndSaveNewStorageIfNotExists: true); return(INTERNAL_PropertyStore.GetValue(storage)); }
public void SetVisualStateValue(DependencyProperty dependencyProperty, object value) { if (dependencyProperty == null) { throw new ArgumentNullException("No property specified"); } var storage = INTERNAL_PropertyStore.GetStorage(this, dependencyProperty, createAndSaveNewStorageIfNotExists: true); INTERNAL_PropertyStore.SetVisualStateValue(storage, value); }
public void SetAnimationValue(DependencyProperty dependencyProperty, object value) { if (dependencyProperty == null) { throw new ArgumentNullException("No property specified"); } INTERNAL_PropertyStorage storage; INTERNAL_PropertyStore.TryGetStorage(this, dependencyProperty, true /*create*/, out storage); INTERNAL_PropertyStore.SetAnimationValue(storage, value); }
public object GetVisualStateValue(DependencyProperty dependencyProperty) //todo: see if this is actually useful (to get specifically the VisualStateValue) and if so, change the GetValue into a GetVisualStateValue at the "return" line. { if (dependencyProperty == null) { throw new ArgumentNullException("No property specified"); } var storage = INTERNAL_PropertyStore.GetStorageIfExists(this, dependencyProperty); PropertyMetadata typeMetadata = dependencyProperty.GetTypeMetaData(this.GetType()); return(INTERNAL_PropertyStore.GetValue(storage, typeMetadata)); }
public object GetAnimationValue(DependencyProperty dependencyProperty) { if (dependencyProperty == null) { throw new ArgumentNullException("No property specified"); } var storage = INTERNAL_PropertyStore.GetStorageIfExists(this, dependencyProperty); PropertyMetadata typeMetadata = dependencyProperty.GetTypeMetaData(this.GetType()); return(INTERNAL_PropertyStore.GetValue(storage, typeMetadata)); }
public void CoerceValue(DependencyProperty dp) { if (dp == null) { throw new ArgumentNullException("No property specified."); } INTERNAL_PropertyStorage storage; INTERNAL_PropertyStore.TryGetStorage(this, dp, true /*create*/, out storage); INTERNAL_PropertyStore.CoerceValueCommon(storage); }
/// <summary> /// Returns the local value of a dependency property, if a local value is set. /// </summary> /// <param name="dependencyProperty"> /// The DependencyProperty identifier of the property for which to retrieve the /// local value. /// </param> /// <returns> /// Returns the local value, or returns the sentinel value UnsetValue if no local /// value is set. /// </returns> public object ReadLocalValue(DependencyProperty dependencyProperty) { var storage = INTERNAL_PropertyStore.GetStorageIfExists(this, dependencyProperty); if (storage != null) { return(storage.Local); } else { return(INTERNAL_NoValue.NoValue); } }
internal void ResetInheritedProperties() { foreach (DependencyProperty property in INTERNAL_AllInheritedProperties.Keys) { INTERNAL_PropertyStorage storage; if (INTERNAL_PropertyStorageDictionary.TryGetValue(property, out storage)) { INTERNAL_PropertyStore.ResetInheritedValue(storage); INTERNAL_PropertyStorageDictionary.Remove(property); } } INTERNAL_AllInheritedProperties.Clear(); }
public void SetValue(DependencyProperty dp, object value) { // Verify the arguments: if (dp == null) { throw new ArgumentNullException("No property specified"); } INTERNAL_PropertyStorage storage; INTERNAL_PropertyStore.TryGetStorage(this, dp, true /*create*/, out storage); INTERNAL_PropertyStore.SetValueCommon(storage, value, false); }
protected internal override void INTERNAL_OnAttachedToVisualTree() { if (this.BorderBrush == null) { INTERNAL_PropertyStore.ApplyCssChanges(null, null, Border.BorderBrushProperty.GetMetadata(typeof(Border)), this); } #if REWORKLOADED this.AddVisualChild(this._child); #else INTERNAL_VisualTreeManager.AttachVisualChildIfNotAlreadyAttached(_child, this); #endif }
internal void ResetInheritedProperties() { if (INTERNAL_AllInheritedProperties != null) { foreach (DependencyProperty property in INTERNAL_AllInheritedProperties.Keys) { if (INTERNAL_PropertyStorageDictionary.ContainsKey(property)) { INTERNAL_PropertyStore.ResetInheritedValue(INTERNAL_PropertyStorageDictionary[property]); } } INTERNAL_AllInheritedProperties.Clear(); } }
internal List <DependencyProperty> INTERNAL_PropertiesForWhichToCallPropertyChangedWhenLoadedIntoVisualTree; // When a UI element is added to the Visual Tree, we call "PropertyChanged" on all its set properties so that the control can refresh itself. However, when a property is not set, we don't call PropertyChanged. Unless the property is listed here. /// <summary> /// Returns the current effective value of a dependency property from a DependencyObject. /// </summary> /// <param name="dependencyProperty"> /// The DependencyProperty identifier of the property for which to retrieve the /// value. /// </param> /// <returns>Returns the current effective value.</returns> public object GetValue(DependencyProperty dependencyProperty) { //#if PERFSTAT // var t = Performance.now(); //#endif var storage = INTERNAL_PropertyStore.GetStorageIfExists(this, dependencyProperty); PropertyMetadata typeMetadata = dependencyProperty.GetTypeMetaData(this.GetType()); var tmp = INTERNAL_PropertyStore.GetValue(storage, typeMetadata); //#if PERFSTAT // Performance.Counter("DependencyObject.GetValue [" + dependencyProperty.Name + "]", t); //#endif return(tmp); }
public object GetVisualStateValue(DependencyProperty dependencyProperty) //todo: see if this is actually useful (to get specifically the VisualStateValue) and if so, change the GetValue into a GetVisualStateValue at the "return" line. { if (dependencyProperty == null) { throw new ArgumentNullException("No property specified"); } INTERNAL_PropertyStorage storage; if (INTERNAL_PropertyStore.TryGetStorage(this, dependencyProperty, false /*don't create*/, out storage)) { return(storage.AnimatedValue); } return(dependencyProperty.GetTypeMetaData(this.GetType()).DefaultValue); }
internal List <DependencyProperty> INTERNAL_PropertiesForWhichToCallPropertyChangedWhenLoadedIntoVisualTree; // When a UI element is added to the Visual Tree, we call "PropertyChanged" on all its set properties so that the control can refresh itself. However, when a property is not set, we don't call PropertyChanged. Unless the property is listed here. /// <summary> /// Returns the current effective value of a dependency property from a DependencyObject. /// </summary> /// <param name="dependencyProperty"> /// The DependencyProperty identifier of the property for which to retrieve the /// value. /// </param> /// <returns>Returns the current effective value.</returns> public object GetValue(DependencyProperty dependencyProperty) { //#if PERFSTAT // var t = Performance.now(); //#endif var storage = INTERNAL_PropertyStore.GetStorage(this, dependencyProperty); //return dependencyProperty.Store.GetValue(storage); var tmp = INTERNAL_PropertyStore.GetValue(storage); //#if PERFSTAT // Performance.Counter("DependencyObject.GetValue [" + dependencyProperty.Name + "]", t); //#endif return(tmp); }
public object GetAnimationValue(DependencyProperty dependencyProperty) { if (dependencyProperty == null) { throw new ArgumentNullException("No property specified"); } INTERNAL_PropertyStorage storage; if (INTERNAL_PropertyStore.TryGetStorage(this, dependencyProperty, false /*don't create*/, out storage)) { return(storage.AnimatedValue); } return(dependencyProperty.GetTypeMetaData(this.GetType()).DefaultValue); }
internal override void OnAttached(DependencyObject target) { if (IsAttached) { return; } base.OnAttached(target); var source = FindSource(); PropertyPathWalker.Update(source); //FindSource should find the source now. Otherwise, the PropertyPathNodes shoud do the work (their properties will change when the source will become available) if (ParentBinding.Mode == BindingMode.TwoWay) { PropertyListener = INTERNAL_PropertyStore.ListenToChanged(Target, Property, UpdateSourceCallback); } }