Tim Anderson's ITWriting

Microsoft goes cross-platform with Silverlight (formerly WPF/Everywhere)


Want to reproduce this article?

If you would like to reproduce this article on your own publication or web site, please contact Tim Anderson .

picture of Forest Key

Forest Key, Director, Developer Tools Product Management

Silverlight, or Windows Presentation Foundation

Microsoft is taking its next-generation user interface cross-platform, with a new runtime that lets .NET and XAML run on the Mac and elsewhere. Tim Anderson talks to Forest Key, Director of Developer Tools Product Management at Microsoft.

Microsoft has started talking about user experience. A lot. Forest Key, Director of Developer Tools Product Management at Microsoft, illustrates this with a picture of a tin, a knife, and a tin-opener. Either tool will open the tin, but the difference is the user experience. Aside: what do Google and Apple have in common? Both companies have won market share from Microsoft primarily because of superior usability. Microsoft is paying attention.

Design-centric development

The company’s response is to elevate the role of the designer in software development. The changes are radical, starting with the new user interface framework called the Windows Presentation Foundation (WPF). This is more graphically-oriented than the old Windows API, and includes an XML layout language called XAML, rendered to the screen using hardware acceleration previously used mainly for games. As a result, we can expect rich visual interfaces using scaleable vector graphics, video, 3D effects, transparency, animation and more. WPF is part of Windows Vista and will also run on Windows XP.

In the past, most software development on Windows has been done with Visual Studio. Although this includes visual form designers, it is very much a programmer’s tool and not something most designers would want to work with. Forest Key explains the problem: “The designer, focused on the look, the behaviour, the visualization of data, the usability, the brand impact, might design something and communicate it to the developer colleague as a piece of paper, or as a JPEG or a TIFF file, or as a movie, some media type that in no way correlates to what a developer would implement. Developers focus on functional capabilities. It yields a result that to the developer might be the same but to the designer is a far cry from what they were after. XAML brings the worlds together.”

Unifying designer and developer

This unification of designer and developer comes via new tools aimed squarely at designers. Expression Graphic Designer is for creating and editing both bitmap and vector graphics and can export the results to a variety of formats including XAML. Expression Interactive Designer is a companion product that is for building a rich user interface; again it exports to XAML. Developers can then take these XAML files and add functionality by writing code, typically in C# or Visual Basic .NET, using Visual Studio. The code can be inline with the XAML, but will more often go into separate files, using a technique called “code-behind” which will already be familiar to ASP.NET developers. The advantage is that designers and developers can work together on a project with less risk of conflict.

Expression Interactive Designer

Expression Interactive Designer

XAML Everywhere

Microsoft’s development strategy is based on the assumption that most new applications will either be entirely browser-based, or else will run on the desktop as clients to internet (or intranet) services. This second category is what Microsoft calls a Smart Client, or what Adobe (formerly Macromedia) calls a Rich Internet Application. XAML can be used in both contexts, though it is most at home on the Windows desktop. Under the hood, XAML applications are also .NET Framework applications. Like any C# or VB.NET application, they are compiled to IL (Intermediate Language) and executed by the Common Language Runtime. Once again, this is Windows technology. The awkward question: who is going to code in XAML and restrict themselves to the latest Windows clients, in an increasingly cross-platform world?

Surprisingly, Microsoft does have an answer. I say surprisingly, because until now the company has shown little interest in supporting clients other than Windows, except with plain HTML served up by ASP.NET. If anything it has been retreating, for example ceasing development of Internet Explorer for the Mac. The main efforts to run Windows applications on Unix-like operating systems have come from third parties, like the open-source Wine, which translates the Windows API to Unix system calls, or the Novell-sponsored Mono, for running the .NET Framework on Linux and the Mac.

Now there has been a change of heart. Microsoft has a major new cross-platform initiative called Windows Presentation Foundation Everywhere (WPF/E). “It’s a code name,” notes Key, “we’re looking at a better, more forceful naming for this.”

WPF/E is a cross-platform runtime engine which can render a subset of XAML and execute .NET Intermediate language. “It can be hosted as a plug-in within the core browsers. It can also be natively hosted, so we will provide DLL libraries and a licensing model. We haven’t announced the licensing specifics, but the intent is to provide it in such a way that you could take the runtime and package it up with your application and deploy it,” says Key.

Drilldown into WPF/E

So how much of the Common Language Runtime will be implemented in WPF/E? “It will be a subset of the CLR and a subset of Windows Presentation Foundation,” Key explains. “3D will not be supported, the control set will be a subset. The controls themselves will be smaller, more adaptable for the Web and devices. We can’t go into a lot of the technical details yet, because it’s still being worked out. There will be a Community Tech Preview this summer, and we will ship WPF/E for the browser, cross-platform, in the first half of 2007.

"We’ll also be looking at partnerships with content folks", adds Key, "so that there’ll be a lot of content when we launch that will use this technology, and that will create a virtuous download cycle so more people will have it, more people will use it, it becomes quite ubiquitous. Our goal is to get hundreds of millions of downloads right out of the gate, and get to 70, 80, 90% of all PCs having this technology present."

WPF/E has broad scope. It is aimed at devices as well as desktop or notebook computers, though the device support will follow later than the initial Web release.. Microsoft will support certain platforms directly, including Safari and FireFox on the Mac, Opera, FireFox and IE on Windows, and possibly Linux and Solaris. However, the company is encouraging third-party implementations. “We haven’t worked out the commercial terms yet, the legal framework, that we’ll announce later. We’re working on that. Our goal is to have it be everywhere, so we’ll be focusing on licensing in such a way that people will be able to embrace and use this technology. From a technical perspective, we’ll supply the necessary technical components including source code, so that someone can go and make a native implementation,” says Key.

Microsoft recently discontinued the Mac version of Windows Media Player, preferring to supply the codecs for Windows Media via a third-party, to enable Quicktime playback. Does that mean WPF/E on the Mac will be dependent on these codecs? Apparently not. “We have within the WPF/E runtime a separate media capability, which will play a subset of the windows media codec. So deploying a multimedia experience within a browser page that includes video is very easy and there’s no additional runtime requirement. And that will work fully on the Mac.”

How will the designer, working in one of the Expression tools, know whether their design will run in WPF/E? “All of the Expression tools will have context buttons where you’ll say, target this or that profile. It would limit some of the availability of features. It’s a little bit like Visual Studio with the Compact Framework. Our goal is to make it as seamless as possible for the designer, so that the designer can design once, and then deploy.”

WPF/E versus the Compact Framework

Talking of the Compact Framework, it seems as if there is some overlap between this and WPF/E. Might one replace the other? “The team that’s building this technology is in part the team that builds the Compact Framework. The CF is not compact enough.  We need a Tiny framework, smaller and nimbler, that’s more appropriate for these scenarios. There may also be bridges between the WPF/E and the Compact Framework. We’re looking at all that,” Key remarks.

Microsoft is aiming for a download size of less than 2MB, which sounds ambitious given the level of functionality required. Rendering XAML and multimedia is a high priority, which suggests that there will not be much space left over for the Framework class library, though it’s likely that some sort of Web Services client library will be included.

I asked Joe Stegman, Lead Program Manager, whether WPF/E will interpret or Just-in-time compile .NET code. “The final portable IL engine is not complete so I can't give you any definitive answer but it is likely we will JIT,” was his response.

Javascript and WPF/E

If WPF/E can execute C# and VB.NET, what is the role of Javascript? Javascript is the glue that connects the WPF/E applet to the web page. WPF/E does not have its own Javascript engine, though possibly JScript compiled to .NET IL might run. Instead, it exposes properties and methods to Javascript running in the browser, and raises events which Javascript can handle.

For deployment, the development tools will compile a single binary which in the current demos has a .wpfe extension. This is a bundle that may contain compressed XAML, resources such as images, media and fonts, and .NET code compiled to IL. Here is a snippet of code from Stegman’s presentation at Mix06:

<object/embed id="wpfehost" size="…">
<param name="source" value="default.wpfe"/>
<param name="startuppage" value="default.xaml"/>

In this example, “default.xaml” is one of the XAML files bundled into “default.wpfe”. Potentially, the file could also contain “default.il”, .NET code-behind for the page.

Running WPF/E on Windows

I asked Key what value there is in running WPF/E on Windows, when the full WPF is also available. According to Key, WPF/E has better integration with the browser. You can host a full WPF application within a browser, where it runs in a security sandbox, but this is “somewhat of a black box that happens to be rendering on a page. The ability to program into and out of that black box is limited. WPF/E is more of an open ended island or archipelago, it’s something that’s more connected to the rest of the page, and it’s more appropriate for mashups, where you might be getting data from different places. So in some ways WPF/E is more flexible.”

Another advantage is that WPF/E has no dependency on the full .NET Framework. There are still plenty of machines that do not have .NET installed, or which have an old version. All going well, WPF/E should “just work” on such machines.

WPF/E versus Flash

Is WPF/E an answer to Flash? There are scenarios which both address, says Key, but “What’s unique about WPF/E is that it’s really a feature of WPF. If WPF/E was an initiative in itself, then one might see it as a reactionary competitive play; but it has to be seen in the context of the span from Atlas [ASP.NET] all the way to WinFX and WPF. It’s a broader, more complete story, not surprisingly given the size of our company.”

I also asked about extensibility. Can WPF/E be extended with native code? “For version 2 and beyond we’ll start to look at that. For version 1 our focus is to get to market and to have some limited extensibility but probably not on the execution engine, because that opens up a host of security issues,” says Key.

WPF/E on the desktop

Does it make sense to create a desktop application that uses WPF/E for its UI? “Yes”, Key insists. “That is a scenario that makes perfect sense. It makes XAML a lot more interesting to non-Windows developers. Our implementation of XAML is .NET, but XAML as a language could be used to target other object models. It’s like XML, we’re proposing an open declarative way of describing a user interface.”

The prospect of hosting WPF/E in a desktop application is intriguing, potentially overcoming some of the deployment difficulties inherent to the full .NET Framework, which has a large and somewhat intrusive runtime, as well as offering cross-platform potential. "WPF/E can be hosted natively," says Key, "so you could actually take XAML, host the DLL natively, and attach the XAML UI to a legacy codebase. You could actually compile it into your app. The licensing details for that are “coming soon”, but that is our stated strategic objective, to make it everywhere available.

"From a strategy perspective, we want user experience to be phenomenal across not only Windows but the Web. On Windows we’re going to have the best possible experience, but as you go to any platform we wanted to give developers and designers a way to leverage some of that investment across all of their platforms. It’s a breadth play, " Key explains.

Microsoft's play for breadth

Developers will await the first previews with skepticism, but even to hear the words "breadth play" from Microsoft is a remarkable turnaround. Perhaps the cross-platform potential in .NET will be realized after all.

Mike Harsh has some screenshots of WPF/E in action on his blog.

Copyright © Tim Anderson 27 March 2006