Helpful Silverlight Snippets

Posted 10 February 2010  

Here are a few of the Visual Studio C# code snippets that we use on the Silverlight team when building controls and apps.

Download a zip (7 KB) of them all and extract them into your Snippets folder, which is in your Documents folder: Documents\Visual Studio 2010\Code Snippets\Visual C#\My Code Snippets\. These also work with Visual Studio 2008.

To use a snippet

Inside the code editor, start typing the name of the snippet (such as dp, for a standard dependency property declaration section with a change handler). You should see it in the Intellisense drop-down.

ISDropdown 

Press tab to accept the value.

If there are editing helpers for the snippet, use tab to move through the fields as you fill them out.

ISCompletion

Press Enter when you are finished. This should drop you right into the triple-slash comment field to fill that out.

Included snippets

Name Description
dp A standard dependency property with a property changed handler
dp_attached An attached property declaration
dp_nohandler A dependency property without a change handler
dp_value A value type dependency property with change handler
dp_value_nohandler A value type dependency property without a change handler
inot An INotifyPropertyChanged implementation
test A simple unit test method, descriptive comment, and description attribute
testa An asynchronous unit test method

Hope this helps.

Jeff Wilcox is a software development engineer at Microsoft who leads exciting open source projects on the Windows Azure team. Jeff has been at Microsoft 8 years and is an alumnus of the University of Michigan.

Windows Azure open source

Jeff leads the open source Windows Azure SDK and cross-platform command line tools development team at Microsoft. Offering tooling for OS X, Windows and Linux and SDKs for Node.js, Java, .NET, PHP, Python; the work is open source, licensed under the Apache 2 license.

4th & Mayor

4th & Mayor is the top-rated social app on the Windows Phone Store with thousands of five star reviews. The best foursquare experience for Windows Phone, it is powered by a Node.js backend running on Windows Azure & Amazon Web Services. Jeff Wilcox is the developer of the app.

comments powered by Disqus