ViewModelBase partial?

Aug 16, 2011 at 10:09 AM

Wouldn't it be better to make the ViewModelBase partial so it is possible to share code across all viewmodals?

In this case I would like to create an attached property for all viewmodals.

For now I made a seperate class for this property, but then I don't have the IsInDesignTime property.

Coordinator
Aug 22, 2011 at 2:36 PM

Hi,

This is on the map for V4 beta 1. This version will be released soon but first I have a couple of issues with the V3 installer that I need to solve.

Thanks,

Laurent

Aug 25, 2011 at 9:53 PM

How exactly will this be accomplished? Going to add ViewModelBase source to each project consuming it?

Coordinator
Aug 29, 2011 at 5:54 PM

Mmmm yeah I talked too fast. What happened is that I had this on my backlog some time ago because it sounded like a good idea. However you cannot have partial classes across assemblies. So I cannot declare the ViewModelBase partial and then in your app have another ViewModelBase.cs file with the rest of the declaration.

Instead, I recommend using extension methods, which in essence achieve pretty much the same effect.

Cheers,

Laurent

Aug 29, 2011 at 10:17 PM
you are correct, I didn't think about that.

I can also just create my own CustomViewModelBase inherited from your ViewModelBase and use that in every ViewModel.