Saturday, April 19, 2008

Silverlight 2.0 is on its way to an official release, and with beta 1, we are now seeing a fuller implementation, including a number of standard controls and richer support to accomplish common tasks. If you're new to Silverlight / Windows Presentation Foundation, the place to start is understanding XAML (pronounced zammel) - the Extensible Application Markup Language. XAML is an XML dialect, and thus, follows the traditional tree hierarchy of elements you're used to seeing in XML. The main features of XAML are:

  • Element names correspond to objects. A "<UserControl ...>" in XAML corresponds to the System.Windows.Controls.UserControl class, for example.
  • Type converters understand string property values. Type converters are used to convert a property value, such as Background="White" or Background="#FF0000" to the class behind the property. A type converter parses and understands what you're asking for (as long as you specify something it can convert)
  • Markup extensions. A markup extension is a special way of saying "interpret this property value, don't take it literally or type convert it." Markup extensions are using for referencing resources, creating control templates and data binding.
  • Dependency properties and attached properties. A dependency property is a property that depends on potentially many things - including animation, data binding and the value you explicitly set. An attached property is a special type of dependency property that an object doesn't define. It is "attached" in that the object with the attached property has the property, but it is meaningless to the object itself. The attached property IS meaningful, however, to elements enclosing the object. A great example is a container such as Canvas (it provides absolute positioning) and the attached property Canvas.Left and Canvas.Top - specify these on a child object, such as an Image, and the Canvas knows where to place the Image.
  • Direct connection to code-behind. When built, the XAML file causes generation of a piece of the class specified by the x:Class attribute, and it is here that object identifiers are created to connect to the objects specified by elements in the XAML (as long as the element in XAML has an x:Name attribute defined) This connection also includes connecting to event handlers in the code-behind.

This is a rather quick overview of XAML - over time we will delve deeper into these features and all the aspects of Silverlight.

 

Saturday, April 19, 2008 7:34:03 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]  |  Trackback
Comments are closed.