private void DeleteMethod_OnClick(object sender, RoutedEventArgs e) { Method selectedMethod = ((FrameworkElement)sender).DataContext as Method; _projectEditorViewModel.DeleteMethod(selectedMethod); }