I could be going about this the wrong way. I am trying to put as little code behind in the view as possible, so I want the CanExecute
and Executed
events of my command binding to be handled in my viewmodel, which is my data context.
I'm sure I'm missing something really simple, but I can't think how to do it.
The XAML for the command binding:
<UserControl.CommandBindings>
<CommandBinding Command="DataControls:ParameterCollectionViewModel.UpdateCollection"
CanExecute="???"
Executed="???"
/>
</UserControl.CommandBindings>
DataControls:ParameterCollectionViewModel.UpdateCollection
is a static RoutedCommand
, but the data context is of type ParameterCollectionViewModel
(not that it matters).
How do I get the event handlers in my data context to be the event handlers in the command binding?