1

I am trying to follow standard MSDN steps to form up MVVM architecture in WPF. My folders and class hierarchy are as below.

Models => FormModel.cs ViewModels => MainViewModel.cs => ViewModelBase.cs Views => MainView.xaml

and

=> App.xaml

Please consider these above all in standard approach.

Now I want to create RelayCommand method about which I don't have any idea. Can you please tell me where to put it? Should I create a separate Command folder? Or under any of above folders? Also give an example of RelayCommand if possible as I don't know how to implement RelayCommand method.

Luke Peterson
  • 8,584
  • 8
  • 45
  • 46
Pratik Shah
  • 89
  • 3
  • 10

1 Answers1

2

I would vote for ViewModels in this case - the implementation is only going to be used in ViewModel classes. I wouldn't create a Command folder, as it will sit in there on its own, but if you have similar constructs perhaps a Utilities folder?

Instead of reinventing the wheel, I use MVVMLight from Nuget (others are available) - has a RelayCommand implementation included, and can be used in portable class libraries (for store apps).

kidshaw
  • 3,423
  • 2
  • 16
  • 28