WPF Talk at Boston .NET User Group

Posted on March 15th, 2007 in WPF, Talks by Puneet Sarda

I had a great time yesterday talking about Windows Presentation Foundation at the Boston .NET User Group meeting in Waltham, MA. I have a lot of post session material for all those who attended. Thank you for attending.

Slides (in .XPS format, will open in IE) and XAMLPad Code.

Source Code from Application = Code + Markup (We explored examples in chapter 8 and 9 yesterday).

My blog article on WPF Architecture with links to Channel9 Videos.

Resources:

We looked at the WPF Controls Gallery and Sample Gallery in SDK yesterday. Click on the screenshot below to see where to find them in the sdk documentation.

SDK Sample Tree

Tim Sneath maintains a list of WPF bloggers as well has an opml file so you can directly add them to your rss reader

Real World WPF Applications:

You will find many more at Tim’s site as he maintains a list of those too.

 

WPF Architecture

Posted on March 7th, 2007 in WPF by Puneet Sarda

I looked on the net for some detailed article on WPF Architecture. I found the MSDN Documentation but its too detailed and goes into the namespaces even before explaining the basics. I found a video on Channel9 of Chris Anderson doing a whiteboard session explaining the architecture. Greg Schechter also has an hour long video on Channel9 where he talks about WPF architecture , Windows Vista DWM and many other things.

I thought all that I learned from watching these videos could be summarized in an article to explain the architecture and save others the trouble of watching the videos (only if you dont have the time for it, otherwise you would learn a lot from them).

In WPF you have a Visual Tree of all the objects in your XAML file. This is a tree with all the visible UIElements as well as the other visual core components that make up each object. Now the UI thread running your application manages the Visual Tree. WPF has a Single Threaded Model and your UI thread is the only thread you as a developer have to manage. Any UI element must be accessed via this thread. Apart from the UI thread, there is a Render thread running in the background. The Render thread is responsible for creating and managing a Composition Tree based on the Visual Tree. Remember that in WPF a button can have its content as a Grid which might have an Image as the content of its each cell. In other words, elements can be composed of other elements and this composition can be as nested as you want it to be. The Composition Tree layouts the entire compositon of all the elements in the XAML file. The Render Thread is responsible for navigating through this entire tree and rendering the elements.

Visual Tree and Composition Tree

An important point to note here is that as changes happen on the visual tree e.g.: a radio button is selected, only those deltas are communicated to the render thread and accordingly the composition tree is updated. Also the re-rendering happens only for those deltas instead re-rendering or repainting the whole screen. The render thread is responsible for talking to Direct3D and rendering the content. Lets see how that happens.

WPF architecture

The above diagram explains the WPF architecture. At the lower most level you have the Kernel , your graphics drivers etc… on top of it you have 2 modules. USER32 is reponsible for deciding what window goes where on your screen. So each window gets its allocated space by this guy. Direct3D is responsible for rendering the content of each of these windows. Direct3D talks to the graphics drivers and sets the pixels on the monitor. milcore is not a publically exposed API but futured versions of WPF might see it opened up to developers maybe via other interfaces than the ones explained below.

On top of Direct3D, the WPF team built milcore.dll. MIL is an acronym for Media Integration Library. This is an unmanaged module and is basically the composition engine thats providing features like 2D, 3D, animation etc… Its the one that directly communicates to Direct3D and can be thought of as a middle man between the rest of WPF and Direct3D. There is also a WindCodecs.dll which houses the unmanaged implementation of various imaging codecs like png, jpeg etc…

On top of this you have the .NET 3.0 Common Language Runtime. Above this layer is the PresentationCore which is a mix of managed and unmanaged code. This is a low level API exposed by WPF providing features for 2D, 3D, Geometry etc… Above this is the managed PresentationFramework. I provides access to high level features like applications, controls, styles etc.. Also you have access to layouts, data, content and actions which help you build up your entire application.

So thats the WPF architecture.

Experience Vista in a browser

Posted on February 2nd, 2007 in Vista, WPF by Puneet Sarda

Check this out!!… Made from Dec CTP of WPF/e….this is one of the best applications out there. If you don’t have the ctp installed..the website will take you to page where you can download this from. Btw, the Feb CTP is out so download that and this app will show you that if a CTP is so powerfull..just wait till the final version is out :)

Click to enlarge:

Vista

A better presentation tool

Posted on February 1st, 2007 in WPF by Puneet Sarda

For who knows how long we have been using PowerPoint for our business presentations. Unless you are well conversant with Flash and other fancy multimedia tools, a “cool” presentation usually means slide transitions in power point.

Electric rain addresses this with their new product Stand Out. Check out the demo… of course its a Windows Vista App but will run on XP with .NET 3.0 installed.

Expression Blend Beta 2 out

Posted on January 31st, 2007 in WPF by Puneet Sarda
The Expression team announced the availability of Blend Beta 2. Download it now!!
Update: Expression Design Beta 1 is also out.