Silverlight Tips Grab Bag for NovemberSubmitted by smartyP on Mon, 11/16/2009 - 21:09
I haven't written a grab bag in a while, so here is a rather impromptu set of tips from lessons learned in developing full-time in Silverlight the last several months. I hope to get better at blogging these things more frequently, but hopefully this grab bag will be useful to some.
Have Good INotifyProperty Snippets
There are several Visual Studio snippets on the web relative to implementing the INotifyProperty interface and corresponding properties in Silverlight. You should find snippets that fit your style and know how to tweak them if needed - you can edit these snippets easily in notepad.
The images below link to their corresponding snippets attached to this post - these are the snippets I'm currently using. You can use the notify property snippet with the keyword notifyp, and you can use the INotifyPropertyChanged implementation with inotifyp. You'll want to save both of these snippet files to your ..\Documents\Visual Studio 2008\Code Snippets\Visual C#\My Code Snippets\ folder.
The main thing to note is that the setters for the properties are comparing the values and only firing the notification if the value actually changed - this helps prevent firing events that update listeners and UI when the value didn't actually change.
(more after the break..)