Extensible Application Markup Language

Template: Infobox file format / Maintenance / Magic number is missing template: Infobox file format / Maintenance / default missing

Extensible Application Markup Language (XAML, pronounced [ Zae: mɛl ] ) is a technology developed by the Microsoft company general description language for the interface design of applications and the definition of workflows in Windows Workflow Foundation ( WF). First NET NET, the new declarative language for the framework. 3.0 and. 3.5 in Windows Presentation Foundation ( WPF) developed for WPF Windows applications. In WF XAML is used because there workflow in turn can be defined using XAML. XAML is also used in Silverlight applications and Windows 8 in the Windows Runtime Windows Store apps based the design of the graphical user interface.

  • 5.4.1 Example: Style
  • 5.4.2 Example: Template

Survey

XAML is an XML - based language that is used to define graphical elements, user interfaces, behaviors, animations, transformations, display of color gradients, play media files and much more. XAML was introduced by Microsoft as in the Windows Presentation Foundation, a desktop - oriented technology, to be used markup language. WPF provides the use of rotations, animations, and a number of other effects and functionalities that are rendered XAML for 2D and 3D objects. XAML elements can directly (CLR ) depict common language runtime object instances, whereas attributes CLR properties and events can be mapped to these objects. In a typical use XAML files of optically oriented design and development tools such as Microsoft Expression Blend, Microsoft Visual Studio, XAML Pad or Windows Workflow Foundation Visual Designer will be generated.

Although XAML was introduced as an integral part of WPF, XAML standard is not specific in itself with the WPF or. NET linked. With XAML you can be using any other programming interface (English application programming interface, API) develop applications, XAML is an independent language. The main aspect of this technology is the reduced complexity, the programs must have to process XAML, because it is basically simple XML. Because XAML is based on XML, developers and designers can share and collaborate on content, since the code is not compiled at runtime. As in XML, a distinction is in XAML is case- sensitive.

Designer - developer workflow

In the application development XAML is so to speak the common language between designers and developers. The graphic designed with the designer tool, the user interface and generates XAML code. The developer takes up this XAML code and developed in his language of choice to the program logic. XAML objects that were created by the designer, provided by the developer with program logic functionality. Both designers and developers can practically simultaneously work on the same project and no longer need to communicate with each other in a roundabout way.

In Silverlight and WPF applications, this collaboration between designers and developers, inter alia, to the use of two different file types for user interface and program logic is clear: the XAML file (file extension xaml. ) That contains the stored graphical XAML descriptions, and one associated with this file code-behind file that contains the program logic for declarative XAML objects. . NET In the code-behind files are provided depending on language with appropriate file extensions: In C # and Visual Basic, there are the extensions xaml.cs or xaml.vb, in JavaScript is called the file extension xaml.js.. ..

XAML in Silverlight

In Web applications, XAML is used mainly in the form of Silverlight. Microsoft Silverlight is an altered, reduced in scope subset of WPF. During development it was called WPF / E, which stood for " Windows Presentation Foundation Everywhere". Microsoft Silverlight allows you to make WPF applications as Rich Internet Applications with the same or minimally altered program code available online, without the whole must be installed. NET Framework on the client computer. 3D features are not currently supported, but XPS, vector-based graphics and hardware acceleration, hence the rendering of rich user interfaces is possible for Web pages.

A variety of media can now be seamlessly integrated into the new surfaces including audio, video and 2D graphics. Important graphical aspects by XAML description are:

  • Automatic layout
  • 2-D shape elements (Rectangle, Ellipse, etc.)
  • Gradients with GradientBrushes
  • Transformations ( scaling, rotating, shearing, matrices)
  • Animations ( DoubleAnimation, Color Animation, Point Animation)
  • Playing media files

XAML in the Windows Runtime

Beginning with Windows 8 comes next XAML WPF for Windows Store apps that are running under the new Windows Runtime used. XAML in the Windows Runtime is, as well as Microsoft Silverlight, a modified and customized to the extent subset of the Windows Presentation Foundation. The main difference to previous implementations, however, is that this is a completely new, based on native code and COM interface , C # and Visual Basic can be used directly via so-called projections for multiple programming languages ​​, including C. The advantage compared to WPF and Silverlight, both of which build on the Common Language Runtime, is an increased execution speed, since the translation into the native machine code of the processor at runtime ( just-in- time compilation ) is omitted.

Windows Store apps are currently running more than full-screen application and the built-in appearance of the controls has been optimized for operation via touch, which is reflected in standard larger and easier with your fingers -to-use elements.

Structure & Features

Structure

XAML files are structured hierarchically.

One or more elements may, depending on their order, affect the layout and behavior of the surface. Each element has only one parent element (english parent). Each element can have an unlimited number of child elements (English children), only in a few, the number is limited, for example, has the scrollbar not a single child. In all XAML applications, the root object is typically a panel ( or one of its six subspecies ), which takes care of positioning and rendering any content. A panel may in turn contain several other panels.

Properties and settings such as a button are listed as XML or HTML in the day as attributes. Like any XML file has a XAML root tag. In XAML you take a parent object (eg a ), in which one additional children (ie elements ) can be integrated. For the parent object, the root tag corresponding attributes must xmlns and xmlns: x have to provide the information about the parser to use namespaces.

XAML Namespaces

Silverlight

When an element such as used in a Silverlight application in XAML, the Silverlight parser recognizes that you want to create an instance of the UserControl class. But he recognizes not necessarily what UserControl class it should use. So you have to find a way a Silverlight namespace information to specify to use an element.

< UserControl x: Class = " SilverlightApplication1.Page "   xmlns = " http://schemas.microsoft.com/client/2007 "   xmlns: x = " http://schemas.microsoft.com/winfx/2006/xaml " >       < / Grid> http://schemas.microsoft.com/client/2007 is the core of the Silverlight 2 name space. It includes all Silverlight 2 classes, including UserControl and Grid. Usually the namespace is declared without a prefix, so it is the default namespace for the entire document. This means each element is automatically placed in this namespace until it specifies otherwise. http://schemas.microsoft.com/winfx/2006/xaml is the XAML namespace. It includes various XAML features that allow one to take influence on how the document is interpreted. This name space is linked to the prefix X. This means you can assert it by before the element name to write the namespace prefix (eg: ).

Windows Presentation Foundation

In this case one does not use the namespace xmlns = http://schemas.microsoft.com/client/2007 because no Silverlight application is created, but it only refers to the Presentation Core of Windows Presentation Foundation, xmlns = http:/ / schemas.microsoft.com/winfx/2006/xaml/presentation.

< Window x: Class = " WpfApplication1.Window1 "   xmlns = " http://schemas.microsoft.com/winfx/2006/xaml/presentation "   xmlns: x = " http://schemas.microsoft.com/winfx/2006/xaml "   Title = " Window1 " Height = "300 " Width = "300 " >       < / Grid> < / Window> Windows Runtime

The namespaces used for the Windows Store apps for Windows 8 are the same as Windows Presentation Foundation, is that used with the difference as a default member for UI Page instead of Window and this to the implementation in the Windows Runtime ( Windows.UI.Xaml ) refers. Height and width specifications are also unnecessary because Windows Store apps will always run as a full-screen application.

< Page x: Class = " HelloWorld.BlankPage "   xmlns = " http://schemas.microsoft.com/winfx/2006/xaml/presentation "   xmlns: x = " http://schemas.microsoft.com/winfx/2006/xaml " >       < / Grid> < / Page> Linking GUI and Code

To link buttons with a method, for example, one now writes such as Visual Basic or C # so-called partial classes. They share the same namespace. The compiler then creates the necessary links. If - separate counter to the clear recommendation, surface and code - but would like to put code in the XAML document, you can also do this: initiates the appropriate area. Thus, the parser then the corresponding rows not yet interpreted, it must necessarily be enclosed in < [CDATA [ ... ]] > (example from ( VS.80) msdn aspx. ):