I have a WPF UserControl with a ViewModel as DataContext. This ViewModel also contains RelayCommands. From the control I can call these commands (e.g. with a button) <Button Command="{Binding SaveCommand}">Save</Button>
. Now I want to place the control in a window and call the commands from there <Button Command="{Binding SaveCommand}" CommandTarget="{Binding ElementName=myControl}">Save</Button>
. But this does not work. How can I call a command in a child control in XAML?
Thanks a lot Markus
If your main window has different DataContext and you can't reach this command through it you can write