Chapter 3: Controls and XAML


Overview

As you ve seen in Chapter 2, Longhorn platform applications typically consist of an Application object and a set of user interface pages that you write in a declarative markup language called XAML.

The Application object is a singleton and persists throughout the lifetime of the application. It allows your application logic to handle top-level events and share code and state among pages. The Application object also determines whether the application is a single window application or a navigation application.

You typically write each user interface page using a dialect of XML named Extensible Application Markup Language (XAML). Each page consists of XAML elements, text nodes, and other components organized in a hierarchical tree. The hierarchical relationship of these components determines how the page renders and behaves.

You can also consider a XAML page to be a description of an object model. When the runtime creates the page, it instantiates each of the elements and nodes described in the XAML document and creates an equivalent object model in memory. You can manipulate this object model programmatically ” for example, you can add and remove elements and nodes to cause the page to render and behave differently.

Fundamentally, a XAML page describes the classes that the runtime should create, the property values and event handlers for the instances of the classes, and an object model hierarchy ”that is, which instance is the parent of another instance.

All XAML documents are well-formed XML documents that use a defined set of element names. Therefore, all rules regarding the formation of well- formed XML documents apply equally to XAML documents. For example, the document must contain a single root element; all element names are case- sensitive; an element definition cannot overlap another element definition but must entirely contain it, and so on. If you re not familiar with XML syntax, now is an excellent time to learn it.




Introducing Microsoft WinFX
Introducing WinFX(TM) The Application Programming Interface for the Next Generation of Microsoft Windows Code Name Longhorn (Pro Developer)
ISBN: 0735620857
EAN: 2147483647
Year: 2004
Pages: 83
Authors: Brent Rector

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net