Sorry it's been so long since I've updated this blog -- the projects I've been working on for the past few months aren't publicly disclosed, so it's tough to find time (and material!) to write about.

Andre Michaud is a rising star SDET on the Tablet PC platform team.  He helped deliver InkCanvas and stylus input in WPF, but wasn't satisfied that the NetFX v3.0 didn't do anything to make writing battery-conscious applications any easier.

So, he wrote a few words about how to do this.  And now it's the headline article in this month's MSDN Magazine!

http://msdn.microsoft.com/msdnmag/issues/07/07/PowerAware/default.aspx

MSDN Magazine July 2007Great stuff.  Want to see power management features baked into the CLR for NetFX v4 or later?  Write your local representatives...

Today’s apps must work in an increasingly mobile environment and must allow new means of input: ink, touch, and more. Build a great application that encompasses these needs, write an article about what you’ve done, and you may win one of three cool Samsung Ultra-Mobile PCs.

One winner per month, 3/15/07–6/15/07.

Check out CodeProject.com for more details.

WPF v1 doesn't include a color-picker dialog (or a font dialog).  A variety of SDK samples and community samples will undoubtedly fill this void.  That's ok with me -- I've never been happy with the traditional Windows color-picker UI, anyway.  I can never find the color I have in mind, looking at this flattened-out-color-wheel-with-dingy-grey-bottom:

I want a more intuitive UI for selecting color -- something based on a proper color wheel.

Also, as a Tablet PC app developer I need more than just color -- I often want to expose pen width, stylus tip shape, and other properties which affect the rendering of ink, alongside color.  In WPF, this is the System.Windows.Ink.DrawingAttributes class.

So, I've hacked together a custom color-picker dialog for WPF, which also exposes a few settings specific to DrawingAttributes -- and uses an InkPresenter to display a preview ink stroke.  Here's what it looks like (click the image for a full-size screenshot):

Gray is in the center of the comb, red/green/blue and magenta/yellow/cyan occupy the outer poles.  The hue and saturation transition naturally from cell to cell; and each cell is rendered with a gradient brightness, so with just a single glance you should be able to spot any color you have in mind -- or something very near to it.

The code isn't the most beautiful work I've done...  one could have a lot of fun developing a "HoneyComb" layout panel, but that just doesn't seem genuinely (re)useful to me, so I constructed the comb with recursive C# code. :-)  The ink-specific settings should be easy to remove, if not needed -- because ink classes is built into WPF, you don't incur any overhead or additional dependencies by using DrawingAttributes.

Hopefully someone out there will find this useful.  Any suggestions for improvement?  Let me know...

In celebration of WinFX Beta2, I've attempted to recreate the Tablet PC SDK's beloved AutoClaims sample in WPF.

This sample demonstrates: 

  • InkCanvas
    • collecting ink in multiple transparent layers, over an Image resource
    • databinding for Strokes
    • DefaultDrawingAttributes defined in static resources
    • animated Opacity and ZIndex properties for smooth transitions among layers
  • TextBox.InputScope
    • defines a pattern to coerce Tablet Input Panel handwriting recognition for the Year (YYYY) field
  • Scrolling and resizing
    • relative layout techniques
    • ScrollViewer around the Image and InkCanvas elements

...all in 100% pure XAML!

http://www.windojitsu.com/blog/autoclaimsfx.html

Ok, admittedly it probably would've been easier to code some of those lengthy EventTriggers for managing the layers in C#.  And I'm a little bummed to discover than I can't set Panel.ZIndex in partial trust (else you'd be running this app in your browser right now, not reading about it).

Still, it's a fun exercise in what can be done with InkCanvas and XAML, with so few lines of code compared to our WinForms platform.  You really have to compile and run the mundane old WinForms version, and peruse the code, to appreciate this WPF rendition.

Have fun!

I'll be hosting a WebCast on MSDN tomorrow (Tuesday, May 23rd) 12 to 1pm Pacific time...  should I reprise my PDC'05 talk, or should I just spend the whole hour writing code?  There's so much cool stuff to show off, for the upcoming beta release...

http://msevents.microsoft.com/cui/webcasteventdetails.aspx?eventid=1032294694&eventcategory=4&culture=en-us&countrycode=us

Description:

Part of the WinFX Runtime Components 3.0, Windows Presentation Foundation (formerly code-named "Avalon") incorporates a number of features previously found only on the Tablet PC platform, such as digital ink and stylus input. This means WinFX applications will be able to collect, render, and edit digital ink on any system—not just Tablet PC systems. It also means Tablet PC applications will be able to do things that were not possible before, such as collect ink over video, or render ink in 3-D. Join this webcast to learn about the InkCanvas element, Stylus input events, and other Windows Presentation Foundation features that can help you develop richer Tablet PC applications in less time.

Presenter: Shawn Van Ness, Program Manager, Microsoft Corporation

Josh says “Windows Presentation Foundation (aka WPF, aka Avalon) is the best thing to happen to Tablet PC's.”

Josh, I couldn't have said that better...  well done!  (We're trying hard to live up to your expectations, anyway. :-)

This reminds me -- at a recent talk, I happened to mention (to a group of Tablet PC developers) how ScrollViewer could be re-styled to align the scrollbar on the left, for left-handed users.  The response was quite enthusiastic!  Here's the XAML...

http://www.windojitsu.com/blog/leftiescrollviewer.html

Just in case anybody who reads this doesn't read Petzold... http://www.windojitsu.com/blog/inkcanvasvsvisualbrush.html

Here's a fun little InkCanvas sample app, in celebration of the Nov CTP release of WinFX... yeah that's right, it's tic-tac-toe.  What?  This ain't rocket science.  (It does, however, include source code for a very, very simple handwriting recognition engine. :-)

http://www.windojitsu.com/blog/tictactoefx.html

Here's the URL to launch the game: http://www.windojitsu.com/tictactoefx/tictactoefx.application

 

PDC has been fun...  for those of you missed me, here's your chance for a virtual/vicarious chat with me:

    http://channel9.msdn.com/Showpost.aspx?postid=116335

I've been taking some heat for how dull and austere my office looks...  but hey look, it's not much worse than Bill's!

New Tablet PC Team blog is up on blogs.technet.com...

http://www.windojitsu.com/blog/tabletblogs.html

More Posts Next page »