WPF Line-Of-Business App Links

Some WPF Line-of-Business App follow-up after my presentation at DevTeach today: Great Snippets: Great code snippets I have installed into my Visual Studio for WPF development are the Dr Wpf and Nerd+Art snippet packs. WPF Coding Conventions: The coding guidelines I use for WPF are a riff on Paul Stovell’s XAML and WPF Coding Guidelines. Application Quality Guide: [...]

Minority Report or Iron Man

This Channel 9 Video is so impressive, I couldn’t help but think that this is the closest we’ve come to allowing any creative team to invent and then build an interface like the futuristic ones imagined for movies like Minority Report or Iron Man.* * minus the holography bits. although maybe some awesome researcher could come [...]

Silverlight 2 Greasepole Game Engine

If you’re authoring multimedia applications in Silverlight, you might be interested in how each of the core game engine services for Legend of the Greasepole is now implemented for the Silverlight 2 Beta. From C/C++ to a Provider Model-Based .NET Engine When was the last time you looked at code you wrote almost a decade ago? [...]

Silverlight 2 Beta Performance

The Silverlight 2 Beta runs rings around the Silverlight 2 Alpha. However, the lack of hardware acceleration is very noticable (and relevant to an Image-oriented application like Legend of the Greasepole) when running at higher resolutions. For a little perspective: In 1998, the first version of Legend of the Greasepole was released. Platform: Windows PC (95, 98, [...]

Legend of the Greasepole, Silverlight 2 Beta Edition

The Legend of the Greasepole is a game that began its life on July 1st, 1996, when a group of Engineering students from Queen’s University in Canada decided they’d create a way to re-live their unexplainable annual tradition from the comfort of their long-suffering computers. After last year’s XNA port, the release of the Silverlight 2 [...]

Top 3 of Mix08 (for me)

1. The Cirque du Soleil keynote demo, the most engaging articulation of WPF’s “richer, smarter, more productive line-of-business app” message since Avalon Healthcare. 2. More Microsoft Research innovation sees the light of day in the product groups and for developers at large. Deep Zoom becomes available to developers through Silverlight and demoed by the Hard Rock Cafe, [...]

Bring Your Data to Life with WPF Session

The premise behind this session is the idea of separation of UI designers and developers. The UI people don't know how to code business rules. But the UI people need to be able to 'try out' the user interface and easily make changes. This is the designer/developer separation that is in the Web space, only in this case, it's for Windows Forms applications.

For those of you who aren't aware, one of the drawbacks of WPF is the lack of data binding support. This is a significant step back in functionality, if you're used to creating ASP.NET or Windows Forms apps. And it stopped me from using WPF to any great extent.

The session starts out slow, talking about the rationale behind data binding. This is something that I would expect most developers to be aware of, although if he's including designers in his target audience, then I can understand the digression.

Databinding in a WPF form can be done through the latest version of Expression Blend. A new Data pane allows for the selection of a data source (a class, for example). Once the data source has been specified, the property sheet for a control allow the mapping between the control's property and the data source's property to be made. This is a familiar process, although very new to WPF and Expression Blend.

WPF includes the concept of a value converter. This is a function that operates on a bound value with the result from the conversion being displayed. As well, the data binding appears to be hooked up to the property change notification mechanism, in that if a property is programmatically changed, the updated value appears in the form.

There is also a mechanism (INotifyCollectionChanged) which raises an event when the collection is changed. The idea of 'change' in a collection is the addition or removal of an item from the collection. WPF data binding is able to detect and respond to these events.

WPF has replaced the ObjectDataSource class with an ObjectDataProvider. Without seeing the details, I'm guessing there is a lot of similarity in terms of functionality, if not the details.

In the WPF itself, the binding notation looks like the following

<TextBox Test="{Binding Path=Sun.Name, Source={StaticResource solarSystem}}" />

This notation takes the Name property of the Sun object found in the ObjectDataProvider named solarSystem. A little cumbersome, but since it's definable through Expression Blend, that's only an issue for those of you who code in Notepad 2008.

As part of the data binding mechanism, there is the concept of a data template. This greatly resembles a template within ASP.NET, where different fields and controls are displayed based on the mode of the control. One twist is that WPF data templating can be defined based on the type of object being displayed. Within the same list box, a collection of Products will appear with different fields then a collection of Customers, even though the underlying WPF is the same.

The final reveal for the demo is a list box that displayed the information about a solar system not as a list of planet names, but as a graphical representation of the solar system orbit with the images of the planets and the positioning away from the sun based on properties from the object. The cool part is that there is no change to the underlying object necessary to change from a drop down list of properties to the graphical view. Only the XAML needs to be modified. But again, that is the power of WPF.

One word of warning. Not all of the advances in WPF are necessarily available in Silverlight. A concept called a CollectionView was explicitly called out as not being part of Silverlight 2. So if you are developing for the Silverlight market, make sure that the data binding techniques you use are supported before you spend time on it.

WPF provides support for a hierarchical data template. This template because useful when you are trying to create a tree view visualization for your data. It's similar to the list box data template in concept, but the level within the hierarchy becomes part of the mechanism for distinguishing between the different data fields and styles that are used.

It looks to me like data binding for WPF has finally moved towards the standards that we have been used to. The presentation didn't cover error providers and error notification, but a slide at the end suggests that it is, using the IDataErrorInfo interface.

Mix08 - Keynote Day 2

Just got back from the Steve Ballmer / Guy Kawasaki keynote at this year’s Mix. Is Guy ever not on form? He did a great job asking Steve the tough questions, making it fun, and getting a few candid answers, along with some “PR” answers as well, including Steve’s cautious response to “What about [...]

Real World AJAX with ASP.NET Session

I have to give credit to Nikhil Kothari. He just ran a session the way that I like to see sessions run. As I read the title and abstract for the session, I was expecting not much in the way of new information. I actually attended the session mostly because it was the only one in this time slot that might be of interest.

Nikhil started out with just some basic stuff on AJAX. But very quickly he got past that and the session became very interesting. The idea is that if you plan on using AJAX in a "real" application, there are a number of issues that need to be address. Simple issues to identify, but complex to deal with. For example:

History

Say you have a page that makes a number of AJAX calls, updating the screen each time. Then you click on the back button. The typical action is to go to the page prior to the initial view of the current page. But what you generally what to do is go to the results from the previous AJAX call.

The solution is to use an AJAX UpdateHistory control. More details can be found on Nikhil's weblog here. It requires some work by the developer to determine when the browser history needs to be updated, but if you put the effort in, your users will love you. OK, not really. This is one of those features that users will ignore if it's there, because your site is working as they think it should. But if you don't have it, they will hate you. It's almost the same thing.

Indexability

If you have a page that uses AJAX to retrieve and display information, you have a problem with making that page appear in the appropriate place within Google. After all, Google depends on static data for its indexing.

The pattern that Nikhil is suggesting is to create a static page that contains all of the data. Make the data static on page. Put the data into a hidden div. Then create a separate frame and use script to pull the data from the hidden div into the frame. When viewed normally, the data will appear in the frame. When crawled by a spider, the script is not executed, so the data is just available for indexing. This pattern might not work in all situations, but there are enough to make it worthwhile being aware of. Again, a blog post (here) provides some additional details.

Overall, a nice presentation with some useful takeaways.

Silverlight 2 - Fundamentals

I'm sitting through the first part of the Building RIA using Silverlight 2 session. The starting point is some of the new, but quite fundamental elements of Silverlight 2

First off, the schedule of releases at the moment are:

Beta 1 = today, with a non-commercial go-live license

Beta 2 = Q208, including a commercial go-live license

Silverlight 2 now includes a TextBox (only about a year too late).

Silverlight works in a sandbox. It has access to local storage through isolated storage. But basically consider Silverlight applications to have the same level of local storage as your current web browser.

Silverlight supports cross-domain requests, but the target domain needs to be configured (via a policy file) to accept requests from Silverlight.

Silverlight has a number of classes available to allow a number of easy mechanisms to make a request to the current or a different domain. And those requests can be made both synchronously and asynchronously.

A large number of intrinsic controls are now available. And the controls are very skinable.

There is support to one- or two-way data binding. The binding mechanism seems to be quite similar to ASP.NET, although the syntax is a little different.