Wednesday, December 10, 2008

Visual studio Code snippet for Silverlight Dependency Property

For those who don't know what is VS code snippet.

Code snippet is one type of macro which insert a block of code upon if we have to use a block of code frequently we could make that as a snippet and insert whenever we want.Here you will get details about the snippets very well.
Dependency property was introducd in WPF which is very useful in so many situations.But it's syntax is little bit big so that we can't remember always.So I usually prefer snippet for creating DPs in WPF.It's very easy
Right click->Insert Snippet->NetFX30->Define a Dependency Property
Type 'propdp' ->Tab

After getting the snippet we can change it's parameters according to our requirement.
DP Snippet in Silverlight
It was working well until I used the same in Silverlight.The default dp snippet in VS inserts a DP which uses metadata object of type UIPropertyMetadata.But this class is not available in Silverlight.Compile time error!!!!!
So I modified the dp snippet code to make it compatible with Silverlight.Using this you can insert DPs in silverlight without compilation error.
  1. Download the snippet file from here.
  2. Open Visual studio
  3. Tools->Code snippet manager
  4. Select language 'C#'
  5. Click 'Import'
  6. Locate the downloaded .snippet file.
  7. Select the folder for storing snippt.
  8. Click Finish.
  9. You can see the snippet in the code snippet manager.
  10. Now in Silverlight project you can use this snippet.

Happy coding!!!

If you are interested in testing more snippets get more from

Tuesday, December 2, 2008

Deep earth - The open source Silverlight counter part of Google maps

Its a open source silverlight based interactive map like Google maps and wikimapia

Try out here
Source code can be downloaded @