Windows Dev Center

Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DependencyProperty.UnsetValue Field

Specifies a static value that is used by the WPF property system rather than null to indicate that the property exists, but does not have its value set by the property system.

Namespace:  System.Windows
Assembly:  WindowsBase (in WindowsBase.dll)

public static readonly Object UnsetValue

Field Value

Type: System.Object
An unset value. This is effectively the result of a call to the Object constructor.

UnsetValue is a sentinel value that is used for scenarios where the WPF property system is unable to determine a requested DependencyProperty value. UnsetValue is used rather than null, because null could be a valid property value, as well as a valid (and frequently used) DefaultValue.

UnsetValue is never returned out of DependencyObject.GetValue. When you call DependencyObject.GetValue on a dependency property on a DependencyObject instance, one of the following applies:

  • A dependency property has a default value established in metadata and that value is returned. This value might come from DefaultMetadata.

  • Some other value was established by the property system, and the default value is no longer relevant. For details, see Dependency Property Value Precedence.

Setting a DefaultValue of UnsetValue is specifically disallowed.

DependencyObject.ReadLocalValue returns UnsetValue when the requested property has not been locally set.

UnsetValue has a special meaning when used as the return value of a CoerceValueCallback. For details, see Dependency Property Callbacks and Validation.

If you are binding to a database, note that UnsetValue is not equivalent to Value, in a similar way to how Value is not equivalent to a true null.

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

Show:
© 2015 Microsoft