private void MenuItem_Click_EditAccount(object sender, RoutedEventArgs e) { var menu = sender as MenuItem; var item = AccountsListView.ItemContainerGenerator.ContainerFromItem(menu.DataContext) as ListViewItem; var model = item.DataContext as AccountListModel; // Window var accountModel = App.Current.GetService <AccountModel>(); accountModel.Guid = model.Guid; accountModel.Name = model.Name; accountModel.Username = model.Username; accountModel.EmailAddress = model.EmailAddress; accountModel.Password = model.Password; var accountWindow = new AccountWindow(this, edit: true) { DataContext = accountModel }; accountWindow.Show(); }
private void MenuItem_Click_AddAccount(object sender, RoutedEventArgs e) { var window = new AccountWindow(this, edit: false); window.Show(); }