/// <summary> /// Invokes <see cref="ISettingsViewModel.Cancel"/> on all child <see cref="ISettingsViewModel"/>. /// </summary> public void Cancel() { // go to each tab on the settings view and tell them to cancel. foreach (ViewDefinition viewDef in TabViews) { UserControl uc = viewDef.View as UserControl; if (uc == null) { continue; } ISettingsViewModel vm = uc.DataContext as ISettingsViewModel; if (vm == null) { continue; } vm.Cancel(); } Return(); }
/// <summary> /// The function is passed on to the View Model /// </summary> /// <param name="sender">The object sending</param> /// <param name="e">The event arguments</param> private void CancelClicked(object sender, RoutedEventArgs e) { vm.Cancel(this); }