Files
docs-desktop/dotnet-desktop-guide/xaml-services/xnull-markup-extension.md
T
Andy De George 9371b0126b Migrate .NET 3.1/5 WPF guide from dotnet docs (#48)
* add toc/bread changes

* add xaml-services

* add ported wpf content

* add xaml-services info to docfx

* Fix links 1

* Fix links 2

* Fix links 3

* Fix links 4

* Fix links 5

* Fix links 6

* Fix links 7

* Fix xaml-services link

* Fix snippets 1

* Fix snippets 2

* adjust breadcrumb and toc

* remove preserve-view from breadcrumbs

* add empty view to toc item xaml

* update include

* remove contextual toc for vs article :(
2020-09-17 08:41:01 -07:00

2.4 KiB

title, ms.date, f1_keywords, helpviewer_keywords, ms.assetid
title ms.date f1_keywords helpviewer_keywords ms.assetid
x:Null Markup Extension 03/30/2017
NullExtension
x:NullExtension
x:Null
Null
xNull
Null markup extension in XAML [XAML Services]
x:Null markup extension [XAML Services]
XAML [XAML Services], x:Null markup extension
2e3ccc21-4996-481d-91b5-3910d8b3bfa3

x:Null Markup Extension

Specifies null as a value for a XAML member.

XAML Attribute Usage

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

Remarks

The keyword for a null reference in C# and C++ is null. The Microsoft Visual Basic keyword for a null reference is Nothing, but you always use {x:Null} as the XAML usage regardless which code-behind language you associate with the XAML.

The x:Null markup extension has no settable properties.

A null usage is often associated with the XAML member exposure of a CLR xref:System.Nullable%601 value.

The x:Null markup extension, like all XAML markup extensions, uses the braces ({,}) for escaping the handling of attribute values to be other than literals or event-handler references. Attribute syntax is the syntax most frequently used with this markup extension. An object element syntax <x:Null /> is technically possible, but is rarely used because the x:Null markup extension has no positional parameters or construction arguments.

For information about markup extensions, see Markup Extensions and WPF XAML.

In .NET XAML Services, the handling for this markup extension is defined by the xref:System.Windows.Markup.NullExtension class.

WPF Usage Notes

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 and can be based on property-specific metadata. Many dependency properties do not accept null as a value, either through markup or code because of their validation callback implementations. For more information about dependency properties, see Dependency Properties Overview.

See also