Freigeben über


x:Null Markup Extension

Specifies null as a value for a XAML property.

XAML Attribute Usage

<object property="{x:Null}" .../>

XAML Object Element Usage

<object>
  <object.property>
    <x:Null/>
  </object.property>
</object>

Remarks

null is the keyword for a null reference in C# and C++. The Microsoft Visual Basic .NET keyword for a null reference is Nothing.

The x:Null markup extension has no settable properties.

Note that null is not necessarily the initial unset value for a reference-type dependency property. The initial default value can vary for each dependency property. Many dependency properties will not accept null as a value, either through markup or code, due to their validation callback implementations. For details on dependency properties, see Dependency Properties Overview.

x:Null is a markup extension. All markup extensions in XAML use the { and } characters as recognized by XAML reader implementations for escaping the handling of attribute values to be other than literals or handler references. Attribute syntax is the most common syntax used with this markup extension. x:Null may also be used in property element syntax. For details on markup extensions in general, see Markup Extensions and XAML.

In the WPF XAML reader implementation, the handling for this markup extension is defined by the NullExtension class.

See Also

Reference

UnsetValue

Concepts

XAML Overview
Markup Extensions and XAML