1

Possible Duplicate:
Why use MVVM?

I am trying to implement MVVM in my WPF Project, but since i started i am finding hard to accomplish by desired task.

I am using Caliburn Micro for MVVM, I am finding hard to call other other ViewModel property from a ViewModel and also cannot able to handle Event of controls like GotFocus of textBox.

Is MVVM really better than CodeBehind, I am not using MVVM for testing purpose.

Please help.

Community
  • 1
  • 1
Kishore Kumar
  • 12,675
  • 27
  • 97
  • 154
  • 3
    There are many many answers here on SO that highlight the importance and need of MVVM. Please read them all and then come back here. – Mamta D Sep 20 '12 at 07:09

1 Answers1

2

MVVM eases automated testing, and it helps you keep your code clean through a separation of concerns.

If you don't do automated testing, mainly the second reason remains (there are other, minor advantages, but this is the main one IMO). If you're having a hard time with pure MVVM, you might want to consider using a hybrid approach: Keep as much as possible in the view model, but don't be afraid to use code behind if it makes your code more readable.

Don't forget: MVVM is a tool, not a goal! It's supposed to make your life easier, not harder. If you have to write 50 lines of boilerplate code over two layers of indirection just to avoid a single-line GotFocus handler, you might be overdoing it.

Heinzi
  • 167,459
  • 57
  • 363
  • 519