Files
docs-desktop/dotnet-desktop-guide/xaml-services/index.md
T
Andy (Steve) De GeorgeandGenevieve Warren ea8529f082 WPF publish initial content (#1032)
* Add overview article for new WPF (#178)

* Remove previous WPF .NET 5 content

* Overview article

* New article: Create new WPF project (#183)

* Basic index file

* Finish article for new project.

* acro

* markdown fix

* Fix build errors

* fix code lang

* fix code lang

* Add differences article for WPF (#186)

* Fix VS version for create app

* Add differences article

* Minor

* fix overview styles code

* Add code langs for overview

* Port Window Overview WPF article (#1011)

* Add Window overview article

* Add TOC

* Remove temp code

* Fix headers

* Port final Windows related articles (#1015)

* Initial test commit

* Add system dialogs

* 75% complete

* Add images

* Fix linter

* Add to toc

* Add more howto

* Fix code

* Add get/set main window

* Add missing code

* Add to toc

* Fix warnings

* Fix warnings

* missing code

* Update see also

* fix xref

* Migrate wpf net core controls-styles articles (#1023)

* Migrate control-styles

* Fix links

* Fix links

* Port databinding article. (#1022)

* Migrated databinding overview

* update toc

* Fix links/snippets

* fix links

* Move to correct folder

* Port initial resources docs (#1026)

* initial resources docs

* Build errors

* Update dotnet-desktop-guide/net/wpf/systems/xaml-resources-overview.md

Co-authored-by: Genevieve Warren <[email protected]>

* Apply suggestions from code review

Co-authored-by: Genevieve Warren <[email protected]>

* Feedback

* Add app article

* Add system article

* Minor

* meta

* fix toc

* Apply suggestions from code review

Co-authored-by: Genevieve Warren <[email protected]>

Co-authored-by: Genevieve Warren <[email protected]>

* Add xaml article

* reformat redirect

* Redirects

* WPF update XAML article  (#1031)

* convert snippets

* minor edits

* minor

* Fix warnings

* Fixes #1028

* Fixes #1028

* Apply suggestions from code review

Co-authored-by: Genevieve Warren <[email protected]>

* update redirects

Co-authored-by: Genevieve Warren <[email protected]>

* minor updates to link

* Readd migration article

* Warning fixes

* Fix lint

* Minor updates

* Fix warnings for TOC/YML

* last warnings

Co-authored-by: Genevieve Warren <[email protected]>
2021-04-15 12:52:05 -07:00

11 KiB

title, description, ms.date, helpviewer_keywords, ms.assetid
title description ms.date helpviewer_keywords ms.assetid
XAML Services Describes the capabilities of a .NET XAML Services. Services include readers and writers, schema classes and schema support factories, attributing of classes, XAML language support, and other XAML language features. 03/30/2017
XAML [XAML Services], System.Xaml concepts
XAML Services in WPF [XAML Services]
System.Xaml [XAML Services], conceptual documentation
0e11f386-808c-4eae-9ba6-029ad7ba2211

XAML Services

This topic describes the capabilities of a technology set known as .NET XAML Services. The majority of the services and APIs described are located in the assembly System.Xaml. Services include readers and writers, schema classes and schema support, factories, attributing of classes, XAML language intrinsic support, and other XAML language features.

About This Documentation

Conceptual documentation for .NET XAML Services assumes that you have previous experience with the XAML language and how it might apply to a specific framework, for example Windows Presentation Foundation (WPF) or Windows Workflow Foundation, or a specific technology feature area, for example the build customization features in xref:Microsoft.Build.Framework.XamlTypes. This documentation does not attempt to explain the basics of XAML as a markup language, XAML syntax terminology, or other introductory material. Instead, this documentation focuses on specifically using .NET XAML Services that are enabled in the System.Xaml assembly library. Most of these APIs are for scenarios of XAML language integration and extensibility. This might include any of the following scenarios:

  • Extending the capabilities of the base XAML readers or XAML writers (processing the XAML node stream directly; deriving your own XAML reader or XAML writer).

  • Defining XAML-usable custom types that do not have specific framework dependencies, and attributing the types to convey their XAML type system characteristics to .NET XAML Services.

  • Hosting XAML readers or XAML writers as a component of an application, such as a visual designer or interactive editor for XAML markup sources.

  • Writing XAML value converters (markup extensions; type converters for custom types).

  • Defining a custom XAML schema context (using alternate assembly-loading techniques for backing type sources; using known-types lookup techniques instead of always reflecting assemblies; using loaded assembly concepts that do not use the common language runtime (CLR) AppDomain and its associated security model).

  • Extending the base XAML type system.

  • Using the Lookup or Invoker techniques to influence the XAML type system and how type backings are evaluated.

If you are looking for introductory material on XAML as a language, you might try XAML overview (WPF .NET). That topic discusses XAML for an audience that is new both to Windows Presentation Foundation (WPF) and also to using XAML markup and XAML language features. Another useful document is the introductory material in the XAML language specification.

.NET XAML Services and System.Xaml in the .NET Architecture

.NET XAML Services and the System.Xaml assembly define much of what is needed for supporting XAML language features. This includes base classes for XAML readers and XAML writers. The most important feature added to .NET XAML Services that was not present in any of the framework-specific XAML implementations is a type system representation for XAML. The type system representation presents XAML in an object-oriented way that centers on XAML capabilities without taking dependencies on specific capabilities of frameworks.

The XAML type system is not limited by the markup form or run-time specifics of the XAML origin; nor is it limited by any specific backing type system. The XAML type system includes object representations for types, members, XAML schema contexts, XML-level concepts, and other XAML language concepts or XAML intrinsics. Using or extending the XAML type system makes it possible to derive from classes like XAML readers and XAML writers, and extend the functionality of XAML representations into specific features enabled by a framework, a technology, or an application that consumes or emits XAML. The concept of a XAML schema context enables practical object graph write operations from the combination of a XAML object writer implementation, a technology's backing type system as communicated through assembly information in the context, and the XAML node source. For more information on the XAML schema concept. see Default XAML Schema Context and WPF XAML Schema Context.

XAML Node Streams, XAML Readers, and XAML Writers

To understand the role that .NET XAML Services plays in the relationship between the XAML language and specific technologies that use XAML as a language, it is helpful to understand the concept of a XAML node stream and how that concept shapes the API and terminology. The XAML node stream is a conceptual intermediate between a XAML language representation and the object graph that the XAML represents or defines.

For more information about XAML node stream concepts, see Understanding XAML Node Stream Structures and Concepts.

The XamlServices Class

It is not always necessary to deal with a XAML node stream. If you want a basic load path or a basic save path, you can use APIs in the xref:System.Xaml.XamlServices class.

For more information about how to use xref:System.Xaml.XamlServices, see XAMLServices Class and Basic XAML Reading or Writing.

XAML Type System

The XAML type system provides the APIs that are required to work with a given individual node of a XAML node stream.

xref:System.Xaml.XamlType is the representation for an object - what you are processing between a start object node and end object node.

xref:System.Xaml.XamlMember is the representation for a member of an object - what you are processing between a start member node and end member node.

APIs such as xref:System.Xaml.XamlType.GetAllMembers%2A and xref:System.Xaml.XamlType.GetMember%2A and xref:System.Xaml.XamlMember.DeclaringType%2A report the relationships between a xref:System.Xaml.XamlType and xref:System.Xaml.XamlMember.

The default behavior of the XAML type system as implemented by .NET XAML Services is based on the common language runtime (CLR), and static analysis of CLR types in assemblies by using reflection. Therefore, for a specific CLR type, the default implementation of the XAML type system can expose the XAML schema of that type and its members and report it in terms of the XAML type system. In the default XAML type system, the concept of assignability of types is mapped onto CLR inheritance, and the concepts of instances, value types, and so on, are also mapped to the supporting behaviors and features of the CLR.

Reference for XAML Language Features

To support XAML, .NET XAML Services provides specific implementation of XAML language concepts as defined for the XAML language XAML namespace. These are documented as specific reference pages. The language features are documented from the perspective of how these language features behave when they are processed by a XAML reader or XAML writer that is defined by .NET XAML Services. For more information, see XAML Namespace (x:) Language Features.