private void BankAccountEdit_Click(object sender, RoutedEventArgs e) { //addEditBankAccountWindow = new AddEditBankAccountWindow() { }; AddEditBankAccountWindow addEditBankAccountWindow = new AddEditBankAccountWindow() { DataContext = DataContext }; _viewModel.LoadBanks(); _viewModel.BankAccount = ((Control)sender).DataContext as BankAccount; addEditBankAccountWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen; addEditBankAccountWindow.Width = 768; addEditBankAccountWindow.Height = 500; addEditBankAccountWindow.CanClose = true; addEditBankAccountWindow.Owner = Window.GetWindow(this); addEditBankAccountWindow.Show(); }
private void BankAccountAddEdit_Click(object sender, RoutedEventArgs e) { AddEditBankAccountWindow addEditBankAccountWindow = new AddEditBankAccountWindow() { DataContext = DataContext }; //var BankAccount = ((Control)sender).DataContext as BankAccount; //if (BankAccount == null) // addEditBankAccountWindow = new AddEditBankAccountWindow() { }; //else // addEditBankAccountWindow = new A90ddEditBankAccountWindow() { BankAccount = ((Control)sender).DataContext as BankAccount }; _viewModel.BankAccount = new BankAccount(); addEditBankAccountWindow.OkClicked += () => { ((BankAccountListViewModel)DataContext).BankAccounts.Add(_viewModel.BankAccount); }; addEditBankAccountWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen; addEditBankAccountWindow.Width = 768; addEditBankAccountWindow.Height = 500; addEditBankAccountWindow.CanClose = true; addEditBankAccountWindow.Owner = Window.GetWindow(this); addEditBankAccountWindow.Show(); }