WPF-specific Snippets in Visual Studio 2008

Visual Studio 2008 comes with some useful snippets for WPF development out of the box. In C# type propa followed by two TAB keystrokes inserts the a snippet for an attached dependency property, including a getter, setter and the registration code.

Similarly propdp followed by two TAB keystrokes inserts a snippet for a dependency property. As you would expect the snippet for this is very similar to the attached dependency property, except in this case it calls DependencyProperty.Register() instead of DependencyProperty.RegisterAttached().

The C# snippet in action

Visual Basic in Visual Studio 2008 has even more snippets defined including RoutedCommand and RoutedEvent registration snippets, and a RoutedCommand handler snippet. I'm primarily a C# kind of guy, so I never realized that VB.NET had the two snippets I mentioned above for C# in VS2005 (with the VS Extensions for .NET 3.0 installed). It seems in this case C# is playing catch-up to VB.NET.

You can look at all the snippets (not just the WPF-specific ones) by selecting "Tools->Code Snippet Manager" from the VS menu. You can of course define your own snippets, but it is nice to see these ones built in to VS2008.