Tim Sneath

Musings of a Client Platform Guy

February, 2006

  • Tim Sneath

    ASP.NET, Atlas, Windows Forms and WPF

    • 23 Comments

    One of the challenges of trying to write a blog like this is getting the level right. I'm conscious that some of my readers are expert "Avalonians" who have been working with the technology since PDC 2003, whilst others are just coming across this technology for the first time or starting out. I try to post things that are interesting at several levels at once, or at least make sure that there's something for everyone. Anyway, this is an extended preamble into a number of positioning questions I'm frequently asked. I figure that it would be somewhat more efficient for me to handle them here on the blog so I can refer others back to them, rather than writing the same reply via email once a week!

    How do Windows Presentation Foundation, XAML and ASP.NET fit together? I've heard you can build web applications using XAML - does that mean that ASP.NET is dead?
    Windows Presentation Foundation uses XAML for constructing user interfaces, certainly. And you can use WPF to build applications that run in a standalone window or in-browser, that's true. But both classes of applications are smart client applications, that is to say that they require the WinFX Runtime to execute. The browser application model in WPF allows for really rich, visually immersive applications to be deployed via the web in a secure manner. However, you're not running HTML when you run a XAML Browser Application (XBAP) - instead, you're simply loading a compiled application within the confines of a browser. ASP.NET is very much alive - it's our server platform for building HTML applications.

    OK then, so I've seen comments about "Atlas forever changing the way web apps are implemented", how does Atlas fit into the whole WinFX picture?
    Atlas is an extension to ASP.NET that makes it simpler to build AJAX applications. It enables web applications to become more dynamic - loading data without requiring a complete page refresh, for instance. We'll ship Atlas as part of "Orcas", the next release of Visual Studio. Atlas is a great way to add greater interactivity to a web application, but it doesn't approach the richness of WPF. For example, it doesn't include support for 3D, animation, or any of the other deep services in WPF - at the end of the day, the browser is still rendering DHTML scripted with JavaScript.

    Right, I get it. So WPF is the new rich client technology for building web and standalone applications in WinFX. Where does that leave DirectX and Windows Forms, then?
    Well both technologies are alive and healthy. In fact, Windows Presentation Foundation does its rendering via DirectX, so that's not going anywhere. The truth is that since WPF provides an abstraction layer over the underlying technology, DirectX is still the best choice for the highest-intensity 3D applications. For example, I don't think we're going to see games like Far Cry written using WPF any time soon. In applications where the highest priority is 3D performance and coding to the metal is the order of the day, then DirectX is the best choice. Where you're prepared to sacrifice a little performance for developer productivity and great integration across 2D, 3D, text, animation and media then WPF is the perfect tool.

    As far as Windows Forms goes, the current release as part of Visual Studio 2005 demonstrates a level of maturity and strength that is enviable. It's the culmination of the last twenty years of development based on the GDI/GDI32/GDI+ platform. It'll be around and supported for many years to come, there's a great ecosystem of controls and plenty of trained developers. WPF sets off in a new direction, building on a new architecture that we hope will last us as long as the GDI world did. The potential with this platform is to build applications that would be completely impossible in Windows Forms, setting a new bar for usability and user experience. We haven't yet released our first version, so there are inevitably a few minor gaps and limitations, but for new applications this is a fantastic emerging platform to build on for longevity. By the way, if you've already built an application with Windows Forms, it's not an either/or choice - we have good interop support and you can embed a Windows Forms control into a WPF application or vice versa. Some early adopters have dipped their toes into the water by building a new WPF visualization or component for their existing application using the interop layer.

    Last question. Windows Forms, ASP.NET/Atlas, DirectX, WPF, Win32 - that's five UI technologies to choose between. How do I decide?
    Really the variety of choice isn't such a bad thing - it enables you to pick the best technology for the job rather than having to pick a lowest common denominator that tries to serve all masters and ends up serving none.

    • Building a forms-based application and looking for a mature technology to use with good tools and component support? Check out Windows Forms - it's got everything you'll need to turn out a well-designed, service-orientated client application.
    • Is platform ubiquity or wireless mobile device support the high order bit? ASP.NET with or without the Atlas extensions is a good technology to choose. (Don't forget about the .NET Compact Framework for rich mobile devices, of course.)
    • Want to build a first-person shooter game, a CAD/CAM workstation application or something similar where polygon count is the major technical requirement? DirectX is a natural choice - don't forget that the .NET managed APIs for DirectX are maturing rapidly and starting to be worthy of serious consideration.
    • Looking for complex data visualization, superb text flow content rendering or dynamic interactive experiences? WPF should probably be your top choice. I'll be posting in future entries about a few sweet spots that early adopter customers have been exploiting to great business gain.
    • Lastly, don't let all this talk of managed code convince you that Win32 is anything other than a vibrant general-purpose way to build applications. There are thousands of new API functions in Windows Vista for Win32 developers to do everything from integrating with the Aero Glass theme to implementing live preview icons and ink-enabled applications. Don't write off Win32, or let others convince you that it's no longer core to Microsoft. It's the platform of choice for tens of thousands of applications. Long may it continue!
  • Tim Sneath

    WPF Major Breaking Changes in Feb 2006 CTP

    • 9 Comments

    This is intended as a quick guide to the major breaking changes that will affect Windows Presentation Foundation applications, rather than providing an exhaustive list:

    • Schemas have changed for WPF and XAML. Instead of:
      http://schemas.microsoft.com/winfx/avalon/2005
      use:
      http://schemas.microsoft.com/winfx/2006/xaml/presentation
      Instead of:
      http://schemas.microsoft.com/winfx/xaml/2005
      use:
      http://schemas.microsoft.com/winfx/2006/xaml
    • We've tightened up the definition of Grids - make sure you wrap ColumnDefinition and RowDefinition elements within a corresponding Grid.ColumnDefinitions or Grid.RowDefinitions element. (Previously you couldn't use this syntax within templates.)
    • SinglePageViewer is now FlowDocumentPageViewer (this makes sense, since the viewer is used for FlowDocuments!)
    • The relative source binding syntax has changed: replace
      {Binding Path=foo, RelativeSource=/TemplatedParent}
      with
      {Binding Path=foo, RelativeSource='{RelativeSource TemplatedParent}'}

    UPDATE: Karsten and I are less well synchronized than normal this week since we're temporarily in different continents. He's posted a separate list of breaking changes on his blog. Check both locations out - he's got a few that I don't have and vice versa.

    UPDATE 2: Rob has a nice tool that makes some of these updates automatically. He also mentions the external assembly referencing breaking change (another one I missed - doh!)

  • Tim Sneath

    WinFX Runtime Components (February CTP) Now Live

    • 7 Comments

    We've just published the February CTP of the WinFX Runtime Components. This is a big step forward for Windows Presentation Foundation in particular, with several months of development work being exposed for the first time. (Those of you with eagle eyes will have noticed that the January 2006 release was identical to the December 2005 release, which in turn only had a couple of minor bug-fixes compared to the November 2005 release.)

    This release demonstrates a number of major performance improvements for WPF applications compared previous releases. We're now API complete for the final release (i.e. there are no more features to be added in, there shouldn't be any more major breaking changes between now and RTM.) If you've only been hovering on the sidelines of WPF, now is a perfect time to come and join the party!

    I'll post a separate entry outlining some of the major breaking changes since the last CTP, but for now I want to provide the links:

    (The files take a little while to propagate to all the download servers, so allow an hour or so for them to go live if you're experiencing "File Not Found" errors.)

    Expect to see a matching update to Expression Interactive Designer soon. (Each version is tied to a specific WinFX release, so the current version doesn't work with the Feb CTP.)

  • Tim Sneath

    First Steps to Learning WPF

    • 14 Comments

    A basic question I'm often asked is "where can I go to learn about WPF?" I like to answer this question here on the blog every now and again, both for new readers and to take account of new or changed materials.

    Here are a few useful resources that I tend to point people to:

    Hope this is useful to some of you.

  • Tim Sneath

    Five Great WPF 3D Nuggets

    • 8 Comments

    If you're building a 3D application using Windows Presentation Foundation, you'll find these links handy:

    • Firstly, Daniel Lehenbauer shares the trackball implementation that we use internally in almost all of our 3D demos for using the mouse to navigate around a 3D space. To use it, you simply attach an instance of the trackball to the window and add the viewport to the Slaves collection surfaced on the trackball. It's a nice handy thing to add when you're importing some 3D geometries into your application.
    • Secondly, Pablo Fernicola pointed me to this fantastic tutorial by Mike Hodnick on creating 3D graphics with WPF. It's not so long as to be daunting, but clearly explained and detailed enough to give you the basics. Make sure you also read his epiphany as he explains why it's important to build more complex meshes rather than creating model groups of simple meshes. (By the way, if you want a more comprehensive primer of 3D graphics, I can personally recommend this title.)
    • Next up, I don't think I've ever linked to this 3D games tutorial on Digital Media Universe's site. WPF wasn't built as a 3D games engine, and I don't think the graphics on this site will give the Halo developers jitters, but they've spent some time building up a nice step-by-step tutorial.
    • I've posted this before, but it was a long while ago. Valentin Iliescu has built an awesome 3D chess game using WPF that demonstrates many key 3D concepts as well as offering a XAML Browser Application (XBAP) in-browser version. He's just added the source code for his samples, which gives me an excuse to highlight this again.
    • Lastly, many of the most impressive demos I've seen come from Robert Hogue, who's been quietly cranking away on new and innovative ways to use WPF from within the darkened cave where he sits in building 10! What I love about his samples is that they often demonstrate concepts that seem on the surface to be hard or impossible in WPF. For example, his mesh morph sample is required viewing for anyone who wants to do shape tweening between 3D models.

    Hope some of these help you. If you're doing something innovative using 3D that I've missed, please add a comment below with a link to your site - I'd love to add to my list here!

Page 1 of 2 (6 items) 12