public MainWindow() { InitializeComponent(); VM = new ViewModel(); CommandBindings.Add(VM.SaveCommandBinding); CommandBindings.Add(VM.ToggleItemSelectionCommandBinding); R.AddHandler( FrameworkElement.MouseDownEvent, new RoutedEventHandler((a, b) => { var part = b.OriginalSource as Border; if (part != null) { VM.ToggleItemSelectionCommandBinding.Command.Execute(part.DataContext); } })); R1.AddHandler( FrameworkElement.MouseDownEvent, new RoutedEventHandler((a, b) => { var part = b.OriginalSource as Border; if (part != null) { VM.ToggleItemSelectionCommandBinding.Command.Execute(part.DataContext); } })); }