private void choose_anomaly_button(object sender, RoutedEventArgs e) { int indexOfChosen = listAnomalies.SelectedIndex; if (indexOfChosen == -1) { MessageBox.Show("Please choose an anomaly!"); } vm.AnomalyGraphButton(indexOfChosen); if (vm.ButtonChosenAnomalyGraphPressed) { AnomaliesGraph.InvalidateVisual(); } else { MessageBox.Show("Please choose an anomaly!"); } }