Files
docs-desktop/dotnet-desktop-guide/xaml-services/xreference-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

1.7 KiB

title, ms.date, helpviewer_keywords, ms.assetid
title ms.date helpviewer_keywords ms.assetid
x:Reference Markup Extension 03/30/2017
x:Reference markup extension [XAML Services]
XAML [XAML Services], x:Reference Markup Extension
Reference markup extension [XAML Services]
2982e68b-d26b-4aa3-826a-34c57a9c5199

x:Reference Markup Extension

References an instance that is declared elsewhere in XAML markup. The reference refers to an element's x:Name.

XAML Attribute Usage

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

XAML Object Element Usage

<object>
  <object.property>
    <x:Reference Name="instancexName"/>
  </object.property>
</object>

XAML Values

instancexName The x:Name value (or value of the xref:System.Windows.Markup.RuntimeNamePropertyAttribute-identified property) of the referenced instance.

Remarks

x:Reference provides XAML language-level support for an element reference concept that was otherwise implemented in specific frameworks such as WPF.

x:Reference and WPF

In WPF and XAML 2006, element references are addressed by the framework-level feature of xref:System.Windows.Data.Binding.ElementName%2A binding. For most WPF applications and scenarios, xref:System.Windows.Data.Binding.ElementName%2A binding should still be used. Exceptions to this general guidance might include cases where there are data context or other scoping considerations that make data binding impractical and where markup compilation is not involved.

x:Reference is a construct defined in XAML 2009. In WPF, you can use XAML 2009 features, but only for XAML that is not WPF markup-compiled. Markup-compiled XAML and the BAML form of XAML do not currently support the XAML 2009 language keywords and features.