InfoQ

InfoQ

News

My Bookmarks

Login or Register to enable bookmarks for unlimited time.

The content has been bookmarked!

There was an error bookmarking this content! Please retry.

.NET 4.0 Brings XAML 2009, but Not for WPF Users

Posted by Jonathan Allen on Dec 02, 2009

Sections
Development
Topics
.NET ,
Compilers ,
Language
Tags
Workflow Foundation ,
FXCop ,
XAML ,
WPF ,
.NET Framework 4.0

At PDC 2009, Michael Shim and Rob Relyea presented Microsoft’s plans for the future of XAML. Currently there are two XAML implementations in .NET, one for Windows Workflow and another for Windows Presentation Foundation. Anyone wanting to use XAML is thus required to take on dependencies on either WF or WPF.

With .NET 4, Microsoft is adding an independent XAML engine in the new System.XAML library. This version only needs System.XML and the core runtimes, making it much more suitable for applications that want to use XAML without loading the Fx libraries.

With .NET 4 we are seeing heavy promotion of XAML Nodes Streams. A node stream is an event-driven API for working with structured data. Readers may be familiar with the XML equivalents based around the SAX-style libraries. In addition to straight processing, XAML Node Streams can be used to alter XAML as it is being loaded by other frameworks.

As part of the refactoring in .NET 4, Microsoft has greatly increased the extensibility of the parser. In .NET 3, the extension points were limited to IXamlTypeResolver, IUriConext, and IProvideValueTarget. The new parser adds support for injecting many other services through these interfaces. Many of these interfaces aren’t new; they just were not publically exposed.

  • IRootObjectProvider
  • IXamlNameResolver
  • IXamlNameProvider
  • IAmbientProviders
  • IDestinationTypeProvider
  • IXamlNamespaceProvider
  • INamespacePrefixLookup
  • IXamlSchemaContextProvider
  • IXamlObjectWriterFactory

Like XML, XAML will have two parsing APIs. In addition to XAML Node Streams, there is going to be a XAML DOM. The XAML Document Object Model allows developers to work with the entire XAML tree at one time. In addition to working directly with the node tree, developers will also have access to a LINQ provider.The combination of the XAML Node Stream and XAML DOM parsers are being used to add support for static analysis tools like FxCOP.

So far we have only been talking about the parser tool, but there is also a new version of the language called XAML 2009. In XAML 2009 we see full support for generics, non-default constructors, factory methods, built-in types, and defining new properties.

Please not that the compilers and designers in .NET 4, VS 2010, and Blend will not be offering XAML 2009 features in this release. XAML 2009 is only available for “loose XAML”, such as the small configuration files used by Workflow Foundation. A major reason for this is that the WPF designers already have their own parsers and rewriting them to use the common parser will take a significant amount of time.

Silverlight will be adopting the same XAML parser that the rest of the .NET ecosystem is using. This will allow for both better error detection and future support for more XAML 2006 and XAML 2009 features. Silverlight still has a requirement to be a lightweight runtime, so they are adding features on a case-by-case basis rather than whole-clothe.

Part of what will enable Silverlight to use the unified XAML parser is the previously mentioned IXamlSchemaContextProvider. By creating a schema context that is specific to the subset of XAML that Silverlight understands, tools will no longer need to hard-code the differences between Silverlight and WPF-based XAML. The Expression Blend team is said to be particularly interested in this functionality.

No comments

Watch Thread Reply

Educational Content

New-age Transactional Systems - Not Your Grandpa's OLTP

John Hugg discusses high volume transaction processing applications with high and low frequency profiles, and how VoltDB can be used for that purpose.

Cool Code

Kevlin Henney examines code samples to see what can be learned from them starting from the premise that one won’t write great code unless he knows how to read it.

Collaboration: At the Extremities of Extreme

Jason Ayers share the observations he made watching a team of developers collaborating in real time on the same code base, pushing XP, pair programming and continuous integration to their extremes.

Yesod Web Framework

Michael Snoyman presents Yesod, a web framework written in Haskell and containing a web server, templating, ORM, libraries (templating, gravatar, etc.).

Transactions without Transactions

Richard Kreuter and Kyle Banker on how to avoid classical RDBMS transactional systems by using compensation mechanisms, transactional messaging or transactional procedures.

Attila Szegedi on JVM and GC Performance Tuning at Twitter

Attila Szegedi talks about performance tuning Java and Scala programs at Twitter: how to approach GC problems, the importance of asynchronous I/O, when to use MySQL/Cassandra/Redis, and much more.

10 tips on how to prevent business value risk

One category of risk that project teams need to ensure they address is business value failure – delivering a product that fails to provide value for the business investor.

Interview: Software Systems Architecture: Working With Stakeholders Using Viewpoints and Perspectives

InfoQ spoke to the authors of Software Systems Architecture on a couple of new topics, the System Context viewpoint and Agile, which have been added to the second edition.