NullExtension Class
Implements a XAML markup extension in order to return a null object, which you can use to explicitly set values to null in XAML.
Assembly: System.Xaml (in System.Xaml.dll)
XMLNS for XAML: Not mapped to an xmlns.
The NullExtension type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ProvideValue | Provides nullptr to use as a value as the output of this markup extension. (Overrides MarkupExtension::ProvideValue(IServiceProvider).) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
In XAML, null and empty string are generally not equivalent. You use the {x:Null} extension usage in order to set an attribute that sets the underlying property to nullptr. For more information on how setting null values is relevant for scenarios in XAML, see x:Null Markup Extension.
This class is a markup extension implementation. Markup extension classes exist mainly to provide infrastructure support for how XAML processors interpret a particular extension. The members that markup extension implementation classes expose are not typically intended to be called from your code. This markup extension class supports the x:Null Markup Extension usage for .NET XAML Services.
In previous versions of the .NET Framework, this class (and the x:Null markup extension XAML behavior support as well as the relevant xmlns mapping) existed in the WPF-specific assembly PresentationFramework. In .NET Framework version 4, NullExtension is in the System.Xaml assembly. This makes the x:Null usage available to applications using frameworks that reference .NET XAML Services. You do not need PresentationFramework as a referenced assembly so long as you are targeting .NET Framework 4. For more information, see Types Migrated from WPF to System.Xaml.
The System.Xaml assembly uses XmlnsDefinitionAttribute to map all types in the assembly to the XAML namespace for the XAML language (http://schemas.microsoft.com/winfx/2006/xaml). Typically you declare a prefix for http://schemas.microsoft.com/winfx/2006/xaml in a root element mapping and use the prefix x.
WPF Usage Notes
For WPF dependency properties, when you set a dependency property value to nullptr, you are not necessarily setting the property to its default value, even if it is a reference property. The default value of a dependency property depends on its dependency property registration. An unset value is not necessarily nullptr either; see UnsetValue. For more information, see ClearValue or Dependency Properties Overview.
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.
