private void Undo_Button_Click(object sender, RoutedEventArgs e) { Button btn = sender as Button; OthelloView v = btn.DataContext as OthelloView; OthelloViewModel vm = v.FindResource("vm") as OthelloViewModel; vm.UndoLastMove(); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 16 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Undo_Click); #line default #line hidden return; case 2: this.OthelloView = ((Cecs475.Othello.Application.OthelloView)(target)); return; } this._contentLoaded = true; }
private void UndoButton_Click(object sender, RoutedEventArgs e) { var viewModel = OthelloView.FindResource("vm") as OthelloViewModel; viewModel.UndoLastMove(); }