Toronto Code Camp 2010: Blendability Follow Up

This past weekend I gave a talk on “Blendability”; The ability to maintain and leverage blend design time compatibility with your WPF and Silverlight projects. Thanks to everybody who came out to the talk, we had some good discussions despite the oppressive heat in the room. You’ll find my slides above. As some of you have requested, here you can find my demos including the MVVM template that was used in the Blend 4 previews that demonstrates the behavior technique for calling methods on your view models.

My SketchFlow Player is empty:

image

Let me officially call this the Grey Screen of Death. You create a lovely sketch flow prototype in Expression Blend and it looks great at design time, but at run-time you get nothing. If you’re clever, you’ll try to dig into the java script error, which fortunately, the nice folks on the SketchFlow player team have raised up from the Silverlight layer. Unfortunately, I’ve found that most errors you get in here are pretty useless.

In my case I was recently getting:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; MS-RTC LM 8; .NET4.0C; .NET4.0E)
Timestamp: Wed, 31 Mar 2010 03:58:03 UTC

Message: Unhandled Error in Silverlight Application AG_E_PARSER_BAD_TYPE [Line: 5 Position: 78]   at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
   at SilverlightPrototype_10Screens.Screen_1.InitializeComponent()
   at SilverlightPrototype_10Screens.Screen_1..ctor()
Line: 1
Char: 1
Code: 0

Your mileage might vary by attaching the visual studio debugger or running the application from within Visual Studio. In my case, I ended up doing some process of elimination pruning to see if I could back track and find the problem. I was having difficulty with some sample data in this case. It was tricky to find, but I’ve determined that you really don’t want a space in your SketchFlow project names. This will cause some erroneous code gen for the loading of the sample data in the sample data classes.

I absolutely love Expression Blend and SketchFlow, but finding this bug was one of those times when I’ve wanted to physically hurt my computer. I hope this helps some poor soul find the root cause a little faster than it took me.

And please share in the comments any other common reasons you’ve found SketchFlow Player failures.

Enter the Stargate Destiny, courtesy of Silverlight, DeepZoom, Photosynth.

This may result in a “geekasm” – you’ve been warned.

http://stargate.mgm.com/photosynth

 

How’d they do it?


MGM Stargate Case Study

Join ObjectSharp for Silverlight on the Silver Screen – July 9 – Scotiabank Theatre Toronto

Silverlight 3 will soon be released.  And to properly celebrate the excitement of its release, ObjectSharp is teaming up with Microsoft to present an action-packed first look at the UX3 platform, live from the Scotiabank Theatre in Toronto. 

As one of the first companies to be featured on Microsoft’s Silverlight gallery, our consultants will share with you their deep knowledge of the next generation of tools.  Whether you are a designer, developer, or purely a marketing geek, you will not want to miss this blockbuster event.  You will see feature-rich demonstrations of Silverlight, Expression Blend, SketchFlow, and  Windows 7 touch technology.  You will also see how these tools can be used to dazzle your customers and gain attention for your brand.

 

 

 

 

 

 

For Developers and Designers:

  • See in-depth demonstrations of Silverlight 3, Expression Blend, and Windows 7 touch technology.
  • Learn how to quickly design user interactions with Microsoft SketchFlow
  • Take Designer/Developer work flow to the next level with Visual Studio Team System
  • Learn how to cut off your bosses head off and paste it on other people’s bodies with Expression Studio

 

For CTOs and Marketing Managers

  • Understand the benefits of creating line-of-business applications with Silverlight and .NET RIA Services
  • Learn how to integrate Rich Media and Advertising with the Microsoft Platform
  • See Touch technology and natural user interfaces bring kiosk applications to life with Windows 7 and WPF

Technologies You Will See:

  • Silverlight 3 featuring WPF & XAML
  • Expression Blend 3 featuring SketchFlow
  • Windows 7 featuring Touch
  • Microsoft Office SharePoint System 2007 (MOSS) for external facing web sites
  • Visual Studio 2010 Team System

Register Online   |   Watch the Movie Trailer

Data Bondage in WPF presentation at Toronto Code Camp

My final presentation in my April World Speaking tour was at the Toronto Code Camp this afternoon. As always, the code camp was a huge success. The efforts of many people went into making it so, but the organization was top notch.

As part of the lead-up to my presentation, Joey de Villa made good on a promise to wear Microsoft branded assless chaps. And he even regaled the crowd with his version of Hit Me With Your Best Shot, a choice completely in character with the theme of the presentation.

As for the presentation, it went very well. Something like 70-80 people where there and I was pleased by the questions that were asked. I have always preferred an interactive audience because it means that they are probably listening. :)

As I promised at the end of the presentation, here are links to the slides and demos. Any questions are most welcome.

Slides: here

Demos: Download

Update: For those who want a more complete story surrounding the title of the presentation and the assless chaps references, check out Joey's blog post here.

Design 101 – The Color Wheel

One of the most common comments from Silverlight and WPF developers is their lack of design sense. Over the next little while, I’ll be posting (interspersed with other topics) on some of the basics of color theory and how they can be applied to WPF and Silverlight.

To start with, let’s talk about one of the fundamental artifacts of color theory – the color wheel.

Color WheelOriginally conceived by Sir Isaac Newton, color wheel is a representation of the colors in the visual spectrum. In the representation, the three primary colors are placed equidistant from one another. The gaps between the the primary colors is then filled with with secondary and tertiary colors.

Now, already I’ve used three terms, only one of which I would expect you to be familiar with. Primary colors (red, blue and yellow) are something that we learned about in elementary school. Secondary colors (orange, green and violet) are created by combining the primary colors. Tertiary colors are those that are formed by combining primary colors with secondary colors.

So now that we have a color wheel, what good is it? Well, it helps identify harmonious colors. When selecting colors to use in a user interface, it is important so select colors that are, in combination, pleasing to the eye. Personally, I understand the challenge to this. As a person born without the color sense gene, I think that pink and lime green go well together. But apparently, I’m in the minority. :)

There are numerous theories about the combinations of colors that promote harmony. We’ll look at some of them in more detail in upcoming blog entries, but to give you a second, two of the most commonly used ones are complimentary and analogous. Complimentary colors are found opposite one another on the wheel. For example, red-green, yellow-violet, and blue-orange are all complimentary. These colors promote stability and contrast in the image.

Analogous colors are sets of three colors that are adjacent to one another on the color wheel. In images using analogous colors, one of the colors tends to be the dominant one. The result is an image that appears to be saturated in the dominant color with the other colors offering a subtle nuances of difference.

Is WPF Dead?

One of the first questions that arose from the announcement of off-browser Silverlight was “What will happen to WPF?” The obvious source of this concern is that since Silverlight 3 can run either as part of a Web page or installed in an off-browser mode, why would there ever be a reason to write a WPF application? And since Silverlight seems to be the technology that has all of the new features, is there a possibility that WPF could languish as the ugly step child in the client application development world ?

First, let me assuage your concerns. WPF is not dead. This opinion is based on a couple of on-going development projects at Microsoft: Expression Blend/Design and Visual Studio. In the case of Expression Blend/Design, the entire application was written in WPF. For Visual Studio, the code editors are being re-written in WPF. If nothing else, the investment being made by Microsoft to these products in WPF should demonstrate its on-going commitment to the technology. And there is the on-going integration of WPF into the Live Messenger client to add more fuel to the argument.

Going forward, I see WPF and Silverlight moving ahead more or less in lock-step. Features in Silverlight that are successful will find their way into WPF (Visual State Manager, for example). Features in WPF that are useful will move into Silverlight (element binding, based-on styles). Since the products have different audiences, each technology will be driven forward with a different set of priorities. VB.NET and C# already have this So don’t give up on WPF because of all of the excitement from Silverlight. As a WPF developer, I found some of the excitement generated by Silverlight announcements a little odd (applause for element-to-element binding? WPF has had that for a while now). What playing with Silverlight 3 that I have done so far suggests that the disparity between the two features sets is going to be much less in the future.

That having been said, there is still the open question of when WPF should be used instead of Silverlight 3. I can see three main cases at a minimum, but they all revolve around the same restriction in Silverlight…the security sandbox.

Access to local system resources

Off-browser Silverlight runs in the same security context as on-browser Silverlight. So if your application needs access to the local file system or the communication ports on the client machine, then Silverlight is not going to work out. In fact, this limitation can be extended in include any feature that requires full-trust to operation. Silverlight doesn’t work in full-trust mode. WPF can.

Full 3-D graphics capabilities

With Silverlight 3, perspective 3-D is available. But that is not the same as the complete 3-D capabilities that WPF has. It’s nice, but if you’re looking for fully rotational 3-D images, then WPF is the choice.

Semi-Esoteric Functionality

There are instances where Silverlight is missing functionality that is available in WPF. For example, there is no Closing event for a Silverlight application. This means that you can’t stop a user from closing an application when the current record has been modified but not saved. In on-browser Silverlight, a JavaScript hack can be used to emulate this feature. But in off-browser Silverlight, there is no JavaScript available, so no Closing event can be detected. While might seem like an edge case, the functionality offered by Closing is part of most LOB application. So it might not be such a small deal as you might originally think.

I’m sure there are more differences. It’s not like WPF is not a compelling choice for a development platform. In fact, I approach the choice between the two the same way I would between WinForms and ASP.NET. Because ultimately, the decision between Silverlight and WPF will be based on the specific requirements of a project. If Silverlight (either on- or off-browser) is sufficient, then pick Silverlight. If not, then pick WPF. Regardless of your choice, you’re not in danger of dead-ending with the technology. Both areas will flourish and grow for many years to come.

MIX ‘09 Keynote – Part 2

More stuff on the Web server side of the equation. There is a new version of the Web Platform Installer. This doesn’t have any impact on me, at least not in the past. But there is now a gallery of community-based applications, such as DotNetNuke, DasBlog and WordPress that can be automatically installed onto a web server through the Platform Installer. Not useful to me, but nice to people who are trying to streamline the build-out of a Web server. You can see a list of these applications here.

Silverlight 3.0 has some new functionality to improve functionality. There will be hardware-based acceleration for compositing, where available. And there are a number of features aimed at improving the media experience. A gentleman from NBC came out and showed some stats on the Beijing Olympics and Silverlight. As well, NBC will do the same for the Vancouver Olympics. Forgive me for not caring, as none of this is available in Canada.

You will probably hear that Silverlight has 3D functionality. A warning that it is not true 3D, but the ability to move a 2D image in three dimensions. The actual term is ‘perspective transform’. If you have to ask about the difference, then you probably don’t care. But for those that do, visualize a flat-screen image that can be rotated about the X-, Y-, or Z-axis so that it appears to be spinning. Hit testing works appropriately (you can only click on the image, regardless of how it is oriented.

Silverlight 3.0 will provide a better experience for SEO. This includes the capability of supporting deep linking and navigation.

Going back to the idea that support for a sketch-based workflow, Expression Blend 3 will have a features called SketchFlow. This feature allows for easy navigation through a collection of pages. The interface allows for quick and simple creation of the workflow through an application. Each state in the workflow corresponds to a page.

One of the things that is interesting about the creation of the pages in a workflow is the inclusion of Wiggly controls. These are controls that, through their appearance, will not be mistaken for a completed application. The borders on the controls take on the appearance of a hand-drawn image. Yet the controls are still real WPF controls, meaning that they work in the Blend and, indeed, when the applications is ‘run’ through the SketchFlow prototyping tool..

On the Road to MIX ‘09

I’m writing this particular blog post while in the air on the way to Las Vegas. For the next three days, I’m going to be at the MIX ‘09 conference. For regular readers of my blogs, that means you can expect a flurry of posts. I tend to live-blog the sessions that I’m in (particularly the keynotes) as a way of note taking, if nothing more. In this way, if nothing more, it is completely different than the MVP Summit I was at a couple of weeks ago.

Actually, there are some other differences. Where the MVP Summit is as much about giving information to Microsoft as it is about receiving, MIX is all about the receiving. While I have some inkling about some of the announcements that you’ll be hearing about, I also know that they have kept some under wraps. Which means that they were even held back from the NDA sessions at the MVP Summit. So, even though I already have some blog posts ready to go, I will still need to pay attention to what’s being discussed. And I’ll pass the good stuff on to you as soon as I can.

The Patch I Didn’t Even Know I Needed

I have been working with WPF and Silverlight pretty steadily for the past 6 months or so. And thanks to Rocky Lhotka, a problem that I didn’t even realize I had has been (probably) corrected.

The problem was that occasionally Visual Studio would just go away. No warning. No error. Just disappear. It didn’t happen that often for me, but I have had awkward moments while teaching a course. Even in that situation, neither I, nor any of the students did anything but shrug, chuckle and restart. These things do happen in the world of software development. The fact that we were willing to just accept it unquestioningly is a blog post for another day.

However, while perusing my blog roll yesterday, I came across this post from Rocky. It talks about a hotfix for a problem that causes Visual Studio to just disappear. Way too coincidental. A quick download and, hopefully, I’m inoculated from this issue going forward. If you’re using WPF in Visual Studio, it’s a fix you might strongly consider.