I am new in MVVM and I am developping an application. I have a form view with a lot of property. About 50. I can not seperate these into usercontrol because I would break the mvvm principles.
I can not seperate these into model, because these contains logic. PropertyChange, Error change and these would not be poco classes, and these are not the model.
Would it be nice If I kept 60 property in a same viewmodel?
Do I think it wrong? How would you organize these?
I'm not sure what you mean by this. Essentially you'll want to use view composition and break down the view model and views into constiuent parts.
A view is a WPF
UserControl
(orWindow
), so if you're using MVVM then you're usingUserControl
's, it's just conceptually they are considered as views in the pattern.I would also recommend that you use an MVVM framework if you're using the MVVM pattern, and something like Caliburn.Micro makes view composition incredibly easy.
I would also not recommend using dependency properties for view models, use INotifyPropertyChanged instead.
Most MVVM frameworks provide a base view model type which includes a lambda based method to invoke the
PropertyChanged
event, thus aiding refactoring.Please don't use
PropertyChanged
for 60Properties
. UseDependencyProperty
. For terms of usabilty use thepropdp
Shortcut from Visual Studio and pressTab
twice.Please refer to this link: http://www.codeproject.com/Articles/62158/DependencyProperties-or-INotifyPropertyChanged