Archive for the 'Examples' Category
PostItBoard Example
Monday, August 7th, 2006In my previous post I promised I’d get you a working copy of the example app. It can be found here. This is just the executable as I am cleaning up the code for the project to make it somewhat more presentable. This demo is made for the July CTP of .NET Framework 3.0. Above you can see a screenshot of the example with around 80 pics sitting on the corkboard…click the pic for a larger version.
You may notice that the details postit is no longer skewed as it was before. This is because there doesn’t seem to be a way to base the orientation of the InkCanvas recogition to the application window. Instead it attempts to recognize gestures in whichever�orientation it happens to be in. This is a good thing, in general, but for this example it made recognition rather difficult since you are forced to skew your gestures to match the skew of the PostIt. Probably not a big deal with a TabletPC and a stylus, but a pain with a mouse.
It will run on Windows XP, but unless you have the Microsoft Windows XP Tablet PC Edition 2005 Recognizer Pack it won’t recognize any gestures (note: this can be installed on any XP operating system, not just the Tablet PC edition). Recognition is built-in to Widows Vista.
Sorry folks, no XBAP edition of this app. Although I generally want to release an XBAP version of each bit so you can see it online without having to download it, getting a browser enabled version of this one up-and-running would be more trouble than it’s worth.
-MGE
Unique Interfaces in WPF/XAML: PostIt Board Example
Friday, August 4th, 2006See the image above? That’s an actual screenshot of the PostItBoard WPF example I’ve been working on. This application attempts to make good use of a non-standard interfaces to provide a rich UX (user experience). It takes a keyword(s), grabs images off of Flickr.com which match those keywords, and displays the photos on the cork board. The images can be moved around the cork board and additional layers of images can be added/removed. As you move your mouse over an image, information on that photo is displayed on the post-it note.
One aspect I focused on for this app is to minimize my input interface while maximizing functionality. I was discussing this with my colleague, Beth Massi, the other day and she suggested using gestures. Great idea! While gestures and gesture recognition is typically the domain of tablet pcs, they are appearing more often in apps made for non-tablets too. To integrate gesture recognition I overlayed an InkCanvas onto the details PostIt note and bubbled up the recognized gestures to the main window. So, if you have 3 layers of images on your cork board you can discard the top layer by issuing a down chevron gesture on the details PostIt with your mouse or a stylus. To clear all photos, make an O gesture. To increase/decrease the size of all the images make a greater-than/less-than gestures. To increase/decrease the number of photos pulled per layer use up/down gestures. Gestures seem to be an effective way to add functionality without having to add interface elements.
Also of note is that the app uses a transparent window, which allows post-its and pics to hang off the edge of the cork board. While this looks visually compelling, I’m not sure the additional CPU requirements would justify the use of a transparent window in this type of app in a production environment.
From a GUI design point-of-view things are pretty straightforward. I’ve created three custom usercontrols: SnapShot, SnapShotQuery, and SnapShotDetails. The SnapShot control takes care of displaying pics and storing information about those pics. The SnapShotQuery gathers information on the type of pics you want to see and uses a RoutedEvent to bubble this information up to the main window. The SnapShotDetails provides a canvas to display additional information about the pic.
The C# code side of things is fairly standard too, with a few exceptions. First, trying to get a group of photos to either not overlap at all or overlap in the least amount was a bit of fun. Luckily the Rectangle object has some limited hit testing built into it. Second, although the initial code to be able to drag the pics around the cork board was straightforward, once I started allowing the pics to be resized it became problematical. I still haven’t worked out this bug, but it seems as if the transformation which changes the size of the pics is changing the visual representation of the objects but not the physical representation. So, while it may look like the pic has been changed from 75×75px to a 120×120px, method calls are still returning info related to the original 75×75 size.
That’s it for now. I’ll have the full demo along with code snippets up next week…apologies folks. I’m traveling right now and don’t have access to my dev environment
-MGE