Most developers are familiar with code snippets. They are really useful while developing code, mainly because they make some of the most common developing tasks easier and faster, by making us just fill in a couple of blanks.
This is great, but Julian had an idea that I believe will make the code snippets we created even more useful. He said: “What if we not only provide the code snippets, but we also add some guidance, links and tips based on our experience as Prism developers, that will help others with these common tasks”. Matias, Ezequiel and me thought this was a great idea, specially for people starting with Prism. The guidance offered in the snippets will provide insight about how Prism works, leading to better and faster development. This guidance can simply be deleted once the code is put into place as it is just composed of code comments.
Without further introduction, the code snippets we created are useful for the most common ways of performing the following tasks (between brackets how to insert the snippet in code):
- View Discovery (prismviewdisc)
- View Injection (prismviewinj)
- Event Publishing (prismeventpub)
- Event Subscribing (prismeventsub)
- Command with attached behavior (prismcmdbehavior, this was updated from this snippet)
Below you can find a picture of the generated code for the Event Subscription snippet, so you can get an idea of about these snippets with tips:
- Download the Snippet Visual Studio installer and run the installer (the snippets are provided “AS IS” with no warranties and confers no rights). You can also get the .zip file from here if you want to edit the snippets.
I hope the snippets help you learn Prism while developing. As always your feedback is really appreciated.