XAML is one language with several vocabularies. A .xaml file does not say which framework it is for; the namespaces on the root do, and some frameworks share a namespace, so a file may fit more than one. The viewer’s Overview tab names the framework it concludes from the file and gives the reason.
Telling them apart
| Framework | Default namespace | Language namespace | Other signs |
|---|---|---|---|
| WPF | …/winfx/2006/xaml/presentation | 2006 | clr-namespace: mappings; roots Window, NavigationWindow, Application, FlowDocument, FixedPage; Style.Triggers, DataTrigger, pack:// addresses |
| Silverlight 2 to 5, Windows Phone Silverlight | the same | 2006 | clr-namespace:…;assembly=System.Windows.Controls.*, VisualStateManager, navigation:Page, phone:PhoneApplicationPage; no triggers except EventTrigger on Loaded |
| Silverlight 1.0 | http://schemas.microsoft.com/client/2007 | 2006 | root Canvas; event names are JavaScript functions |
| UWP, WinUI 2 and 3, Windows Phone 8.1 | the same | 2006 | using: mappings, {x:Bind}, {ThemeResource}, x:Load, ms-appx: addresses, Visibility of only Visible and Collapsed |
| Uno Platform | the same, with platform namespaces (xmlns:not_win="http://uno.ui/not_win", xmlns:android="http://uno.ui/android") and mc:Ignorable for them | 2006 | WinUI style markup that runs on other systems |
| Xamarin.Forms | http://xamarin.com/schemas/2014/forms | 2009 | roots ContentPage, MasterDetailPage; Entry, StackLayout, OnPlatform |
| .NET MAUI | http://schemas.microsoft.com/dotnet/2021/maui | 2009 | Shell, VerticalStackLayout, CollectionView, x:DataType, AppThemeBinding |
| Avalonia | https://github.com/avaloniaui | 2006 | extension .axaml, Style Selector, using: mappings, x:CompileBindings, FluentTheme |
| Windows Workflow Foundation 4 | http://schemas.microsoft.com/netfx/2009/xaml/activities | 2006 (and 2009 for x:Members) | root Activity with x:Class, Sequence, Variable, InArgument |
| Windows Workflow Foundation 3 | http://schemas.microsoft.com/winfx/2006/xaml/workflow | 2006 | .xoml, SequentialWorkflowActivity, StateMachineWorkflowActivity |
| Visual Studio rule files | http://schemas.microsoft.com/build/2009/properties | — | root Rule, children StringProperty, BoolProperty, EnumProperty |
XAML 2006 and 2009
See the language namespace page. The two differ in the namespace of the x: prefix and in what the language allows. A WPF project writes 2006; WPF reads 2009 features only from loose files read by XamlReader or System.Xaml, and does not compile them to BAML.
WPF
The origin of the language: a vocabulary of dependency properties, routed events, resources, styles with triggers, templates, data binding with converters and validation, documents, 3D and animation (elements). What each version added that shows in markup: .NET Framework 3.0, the first; 3.5 SP1, StringFormat on bindings, DataGrid and DatePicker in the toolkit; 4.0, DataGrid, DatePicker and Calendar in the framework, easing functions, VisualStateManager, System.Xaml with XAML 2009 and x:Reference; 4.5, Delay and ValidatesOnNotifyDataErrors on bindings; .NET Core 3.0 and later, the same language, built by the SDK for desktop applications.
Silverlight and Windows Phone
A subset of WPF for the browser plug-in and the phone: no routed Preview events, no property triggers or data triggers (visual states instead), no DynamicResource, no MultiBinding, an ElementName binding, StringFormat from version 4, x:Name as a resource key, Visibility of Visible and Collapsed only, VisualStateManager and CompositeTransform. Silverlight 1.0 used a different root and JavaScript event handlers.
UWP and WinUI
The same language over the Windows Runtime. Differences from WPF: using: mappings; no Style.Triggers; visual states, StateTrigger and AdaptiveTrigger; {x:Bind} (compiled) alongside {Binding}; {ThemeResource}; x:Uid with .resw files; x:Load; ms-appx: addresses; CommandBar, NavigationView, SplitView, RelativePanel; theme dictionaries keyed Default, Light, HighContrast. WinUI 2 is the control library as a package (namespace Microsoft.UI.Xaml.Controls, used in UWP markup with xmlns:muxc="using:Microsoft.UI.Xaml.Controls"); WinUI 3 is the desktop version with Window as a markup root, which is not a visual element; its XAML types are in Microsoft.UI.Xaml where UWP’s are in Windows.UI.Xaml, and the markup text looks the same.
Xamarin.Forms and .NET MAUI
XAML 2009 files for cross-platform pages. The vocabulary is its own (Label, Entry, StackLayout, Grid, CollectionView), with BindingContext instead of DataContext, Command instead of most events, OnPlatform and OnIdiom, Shell navigation, VisualStateManager and x:DataType compiled bindings. MAUI’s namespace differs from Xamarin.Forms’s, and MAUI has handlers where Forms had renderers, which does not show in markup. Both read grid definitions as strings (RowDefinitions="Auto,*"). The XAML of a MAUI project may be compiled to code (source generation) or loaded at run time (XamlProcessing in the project).
Avalonia
A cross-platform framework modelled on WPF: the same elements and binding, with a CSS-like style system (Style Selector=…, classes, pseudo-classes), ControlTheme, using: mappings, compiled bindings, the binding path operators #name, $parent, $self, ^, grid definitions as strings, and the extension .axaml. It does not have Style.Triggers or DynamicResource on non-styled properties in the WPF sense, and its Visibility is the Boolean IsVisible.
Windows Workflow Foundation
XAML that describes a program. The root is an Activity (or a specific one such as Sequence or Flowchart) in the activities namespace; x:Class names a custom activity; x:Members with x:Property declares its arguments (InArgument(x:String), OutArgument(x:Int32)); child elements are activities (Sequence, If with Then and Else, While, Assign, WriteLine, Delay, Parallel, TryCatch, Flowchart, StateMachine), with Variable x:TypeArguments="x:Int32" Name="count" declarations and expressions written in Visual Basic or C# inside [ ] or in expression activities. A .xamlx file is a workflow service with WorkflowService, Receive and SendReply. Workflow 3 files (.xoml) are different markup in the 2006 workflow namespace.
Not described
Known, not yet covered
- Reference: the version history is given as what each major version added in the vocabulary that shows in markup, from memory of the documentation; it is not a full change list, and the version numbers of MAUI, WinUI and Avalonia releases are not given.
- Reference: Windows Workflow Foundation activities, expression syntax (
[ ]and the VB expression text) and the Uno Platform’s platform namespaces are summarised.
Unknown
- Reference: the framework-detection rules of the viewer are heuristics: a file in the presentation namespace with none of the signs above is shown as “WPF, UWP, WinUI or Silverlight”.