Well, if the DataContext is already set you could cast it and call the command:
var viewModel = (MyViewModel)DataContext;
if (viewModel.MyCommand.CanExecute(null))
viewModel.MyCommand.Execute(null);
(Change parameter as needed)
Well, if the DataContext is already set you could cast it and call the command:
var viewModel = (MyViewModel)DataContext;
if (viewModel.MyCommand.CanExecute(null))
viewModel.MyCommand.Execute(null);
(Change parameter as needed)