The new Windows Vista preview pane lets you preview files right within the shell, and Outlook 2007 gives you the same preview capability for email attachments. Pretty cool stuff. But what’s cooler is that this mechanism is extensible. Not only can you preview file types like Word documents and image files, but you can write custom preview handlers for any other extension you like. In the January 2007 issue of MSDN Magazine, we show you how to do exactly that with the article Vista and Office: View Data Your Way With Our Managed Preview Handler Framework, and more specifically how to do it easily in managed code. Here’s an example of the XAML Preview Handler provided with the article… the XAML file attached to the email is being displayed right within Outlook:
There are a bunch of sample preview handlers included with the article, including ones for MSI, PDF, and ZIP, but others have already started jumping on the bandwagon to create their own preview handlers. Tim Heurer has created a great set of preview handlers for code files so that you can preview your code with nice syntax highlighting right within the Vista shell and Outlook:
And Daniel Moth has put together a preview handler for .moth files; not the most useful implementation, but a good example nonetheless. In addition, he’s used the diagramming tools in Visual Studio to put together a nice class diagram of the framework available for download from the MSDN Magazine site. Thanks, Daniel!
In addition, I wrote a follow-up tool that makes it easy to change what preview handlers are registered for what file extensions. You can read more about the tool and download it from http://blogs.msdn.com/toub/archive/2006/12/14/preview-handler-association-editor.aspx.