Class DependencyObject
Represents an object that participates in the Silverlight dependency property system. DependencyObject is the immediate base class of several other important Silverlight classes, such as UIElement, Geometry, FrameworkTemplate, Style, and ResourceDictionary.
Inheritance
Inherited Members
Namespace: System.Windows
Assembly: OpenSilver.dll
Syntax
public class DependencyObject : IDependencyObject
Constructors
| Improve this Doc View SourceDependencyObject()
Initializes a new instance of the DependencyObject class.
Declaration
public DependencyObject()
Properties
| Improve this Doc View SourceDispatcher
Gets the Dispatcher this object is associated with.
Declaration
public Dispatcher Dispatcher { get; }
Property Value
| Type | Description |
|---|---|
| Dispatcher | The Dispatcher this object is associated with. |
Methods
| Improve this Doc View SourceCheckAccess()
Determines whether the calling thread has access to this object.
Declaration
[NotImplemented]
public bool CheckAccess()
Returns
| Type | Description |
|---|---|
| System.Boolean | true if the calling thread has access to this object; otherwise, false. |
ClearValue(DependencyProperty)
Clears the local value of a dependency property.
Declaration
public void ClearValue(DependencyProperty dp)
Parameters
| Type | Name | Description |
|---|---|---|
| DependencyProperty | dp | The DependencyProperty identifier of the property to clear the value for. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | dp is null. |
ClearValue(DependencyPropertyKey)
Clears the local value of a read-only property. The property to be cleared is specified by a DependencyPropertyKey.
Declaration
public void ClearValue(DependencyPropertyKey key)
Parameters
| Type | Name | Description |
|---|---|---|
| DependencyPropertyKey | key | The key for the dependency property to be cleared. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | key is null. |
CoerceValue(DependencyProperty)
Coerces the value of the specified dependency property. This is accomplished by invoking any CoerceValueCallback function specified in property metadata for the dependency property as it exists on the calling DependencyObject.
Declaration
public void CoerceValue(DependencyProperty dp)
Parameters
| Type | Name | Description |
|---|---|---|
| DependencyProperty | dp | The identifier for the dependency property to coerce. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | dp is null. |
GetAnimationBaseValue(DependencyProperty)
Returns any base value established for a Silverlight dependency property, which would apply in cases where an animation is not active.
Declaration
public object GetAnimationBaseValue(DependencyProperty dp)
Parameters
| Type | Name | Description |
|---|---|---|
| DependencyProperty | dp | The identifier for the desired dependency property. |
Returns
| Type | Description |
|---|---|
| System.Object | The returned base value. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | dp is null. |
GetValue(DependencyProperty)
Returns the current effective value of a dependency property from a DependencyObject.
Declaration
public object GetValue(DependencyProperty dependencyProperty)
Parameters
| Type | Name | Description |
|---|---|---|
| DependencyProperty | dependencyProperty | The DependencyProperty identifier of the property to retrieve the value for. |
Returns
| Type | Description |
|---|---|
| System.Object | Returns the current effective value. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | dependencyProperty is null. |
INTERNAL_OnAttachedToVisualTree()
Declaration
protected virtual void INTERNAL_OnAttachedToVisualTree()
INTERNAL_OnDetachedFromVisualTree()
Declaration
protected virtual void INTERNAL_OnDetachedFromVisualTree()
OnPropertyChanged(DependencyPropertyChangedEventArgs)
Invoked whenever the effective value of any dependency property on this DependencyObject has been updated. The specific dependency property that changed is reported in the event data.
Declaration
protected virtual void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| DependencyPropertyChangedEventArgs | e | Event data that will contain the dependency property identifier of interest, the property metadata for the type, and old and new values. |
ReadLocalValue(DependencyProperty)
Returns the local value of a dependency property, if a local value is set.
Declaration
public object ReadLocalValue(DependencyProperty dp)
Parameters
| Type | Name | Description |
|---|---|---|
| DependencyProperty | dp | The DependencyProperty identifier of the property for which to retrieve the local value. |
Returns
| Type | Description |
|---|---|
| System.Object | Returns the local value, or returns the sentinel value UnsetValue if no local value is set. |
SetCurrentValue(DependencyProperty, Object)
Sets the value of a dependency property without changing its value source.
Declaration
public void SetCurrentValue(DependencyProperty dp, object value)
Parameters
| Type | Name | Description |
|---|---|---|
| DependencyProperty | dp | The identifier of the dependency property to set. |
| System.Object | value | The new local value. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | dp is null. |
| System.ArgumentException | value was not the correct type as registered for the dp property. |
SetValue(DependencyProperty, Object)
Sets the local value of a dependency property on a DependencyObject.
Declaration
public void SetValue(DependencyProperty dp, object value)
Parameters
| Type | Name | Description |
|---|---|---|
| DependencyProperty | dp | The identifier of the dependency property to set. |
| System.Object | value | The new local value. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | dp is null. |
| System.ArgumentException | value was not the correct type as registered for the dp property. |
SetValue(DependencyPropertyKey, Object)
Sets the local value of a read-only dependency property on a DependencyObject.
Declaration
public void SetValue(DependencyPropertyKey key, object value)
Parameters
| Type | Name | Description |
|---|---|---|
| DependencyPropertyKey | key | The DependencyPropertyKey identifier of the property to set. |
| System.Object | value | The new local value. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | key is null. |
| System.ArgumentException | value was not the correct type as registered for the property. |