1.1. The Benefits of XAML
XAML offers similar benefits to other markup-based application interface mechanisms such as XUL (eXtensible User-interface Language), HTML (HyperText Markup Language), and Flex. Markup-based interfaces are quick to build and easily modifiable. They require less code than traditional structured programming. For example, creating and defining the properties of a Button with XAML requires just one line of syntax, as opposed to multiple lines in C# or VB.NET:
<Button Click="OnClickHandler" Background="Green" Content="Submit" />
The same Button object created using C# requires four lines:
Button myBtn = new Button( ); myBtn.Background = Brushes.Green; myBtn.Text="Submit"; myBtn.Click += new System.EventHandler(OnClickHandler);
While HTML has limited programmatic functionality and control, XAML and other new-generation declarative markup languages offer back-end scripting language support to circumvent this limitation. While XAML separates the user interface from application logic, it still provides a mechanism by which the two can easily interact. This separation offers several benefits, including easily localized user interfaces and the ability for developers to modify application logic without affecting the user interface, and vice versa.
XAML also opens up user-interface design to a wider group of developers, namely graphic designers and markup developers. Anyone with experience using HTML or other web-oriented markup languages will find XAML to be intuitive; they will be able to jump in and begin developing user interfaces in a short period of time. This alleviates the burden placed on .NET developers and allows them to focus on developing application logic, while others determine the look and feel of the user interface.
XAML is toolable, which offers third-party developers opportunities to create applications that support it. Several third-party applications already exist that offer visual environments for developing XAML. Additional products are expected as Windows Vista begins to be generally deployed.
XAML is extensible, as its name implies. XAML can easily be extended by developers creating custom controls, elements, and functionality. Because XAML is essentially the XML representation of objects defined by the WPF, XAML elements can easily be extended by developers using object-oriented programming techniques. Custom controls and composite elements can be developed and exposed to user-interface designers or shared with other developers.
Finally, by using XAML, Windows applications can be delivered unchanged via the Web to Windows clients. Smart clients, Microsoft's term for rich user interfaces with full Windows functionality, can be delivered to any connected Windows machine over the Internet through a web browser without requiring the overhead of a managed desktop to deploy full-featured thick-client applications.