0

I have a Command bound to my MainWindow via CommandBinding to the Delete key.

I want that, depending on the context (which element is active), the same command would be translated to different delete commands that semantically delete things.

In few words, I want that pressing the Delete key will delete things depending on where the focus is at that moment.

I have heard about CompositeCommands (PRISM), but I don't know whether that is useful an easily applicable here.

Thanks a lot!

SuperJMN
  • 13,110
  • 16
  • 86
  • 185

1 Answers1

0

CompositeCommand in Prism helps you register several commands in one, so that all can be called at the same time.

Since you use MVVM, you should have a ViewModel for each kind of object at least. If you have something like a ViewModelBase or an IViewModel, you could simply add a command to it, and initialize it differently in each ViewModel.

Arhiman
  • 227
  • 1
  • 6