Region-free ViewModel?

Sep 27, 2011 at 7:11 PM

Hi Tony,

Would you consider making a version of the ViewModel template that does not contain regions? I can see why you put them in there, but in my opinion, they are rather cumbersome, and I end up spending time deleting them.

Here's Jeff Atwood's take on regions, which pretty much explains my objections to them:

Thanks very much.

Sep 28, 2011 at 4:29 AM

The simple mvvm viewmodel template is located in (at least on my box)

C:\Users\<username>\Documents\Visual Studio 2010\Templates\ItemTemplates\Silverlight\Mvvm\\

I believe you can simple go into the zip file and remove all the #region tags, save it and never see them again.


For myself, I like having the structure, we're not the most organized shop and being able to aim folks at this framework and knowing our code will end up in about the same place (based on the example and #region tags), it one of its benefits as our team grows into mvvm


Hope that's of some help


Sep 28, 2011 at 11:48 AM
Good suggestion - If you don't like regions, just take them out of the templates.

Good article on the drawbacks of regions. The first thing I do is press Ctrl M, L to expand them. Then I close the ones I don't want to see. Love 'em or hate 'em I guess. :-)

Oct 3, 2011 at 11:29 PM

Good points, everyone. I will say, though, that I prefer not to edit the templates, because then I will have to figure out with each new release whether to use the new template or my old edited one. And if I do decide to use the new template, then I'll have to remove the regions from that.

That said, if regions are really popular, I understand if Tony doesn't want to support and pollute the toolkit with two different templates. Maybe a poll is in order to see whether the community prefers regions or no regions.


Oct 3, 2011 at 11:35 PM

Your post reminded me, I had also thought it should be pretty simple to do a regular expression find and replace to remove regions in VS.  Perhaps even write a vs add-in button to remove regions

Good discussion points