Sunday, January 16, 2011

Customize Windows 7 Preview pane for XAML files

There are times when I want to preview file content in Windows Explorer.  The Preview pane in Explorer makes this a simple task.  Just click the Preview pane button and select the file as shown in Figure 1 and Figure 2.

image-thumb.png

In this example I am previewing a .txt file.   Use the Ctrl + mouse wheel to change the zoom level on the text. Also, ALT+P toggles the preview pane.
Adding your own extensions
Making a simple registry edit allows you to see other files, like .csproj and .xaml, in the preview pane.
Here’s how I did the XAML extension (see Figure 3).
  • Open the HKEY_CLASSES_ROOT\.xaml key in Regedit. 
  • Add a string key named PerceivedType.
  • Set the value of the PerceivedType key to ‘text’.

Read more: Wpf Wonderland