Export (0) Print
Expand All

DependencyProperty.UnsetValue Field

Specifies a static value that is used by the property system rather than a null reference (Nothing in Visual Basic) 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 initonly Object^ UnsetValue
public static final Object UnsetValue
public static final var UnsetValue : Object
You cannot use fields in XAML.

Field Value

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 a null reference (Nothing in Visual Basic), because a null reference (Nothing in Visual Basic) 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.

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.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2014 Microsoft