using System.Windows; using System.Windows.Input; namespace DebtMgr.View { /// /// Interaktionslogik für MainView.xaml /// public partial class MainView : Window { //////////////////////////////////////////////////////////////////////////////////////////////////// /// Default constructor. /// /// Andre Beging, 10.09.2017. //////////////////////////////////////////////////////////////////////////////////////////////////// public MainView() { InitializeComponent(); DataContext = App.Locator.MainView; PersonListView.KeyUp += PersonListViewOnKeyUp; TransactionHistoryListView.KeyUp += TransactionHistoryListViewOnKeyUp; } #region PersonListViewOnKeyUp() //////////////////////////////////////////////////////////////////////////////////////////////////// /// Person list view on key up. /// /// Andre Beging, 10.09.2017. /// /// Source of the event. /// Key event information. //////////////////////////////////////////////////////////////////////////////////////////////////// private void PersonListViewOnKeyUp(object sender, KeyEventArgs e) { if (e.Key == Key.Delete) { if (App.Locator.MainView.DeletePersonContextMenuCommand.CanExecute(null)) App.Locator.MainView.DeletePersonContextMenuCommand.Execute(null); } } #endregion #region TransactionHistoryListViewOnKeyUp() //////////////////////////////////////////////////////////////////////////////////////////////////// /// Transaction history list view on key up. /// /// Andre Beging, 10.09.2017. /// /// Source of the event. /// Key event information. //////////////////////////////////////////////////////////////////////////////////////////////////// private void TransactionHistoryListViewOnKeyUp(object sender, KeyEventArgs e) { if (e.Key == Key.Delete) { if (App.Locator.MainView.DeleteTransactionContextMenuCommand.CanExecute(null)) App.Locator.MainView.DeleteTransactionContextMenuCommand.Execute(null); } } #endregion } }