private void BankChanged(object sender, EventArgs e) { if (FinancialInstitutions.Where(r => r.IsChecked == true).Count() > 0) { Accounts = FinancialInstitutions.Where(r => r.IsChecked == true).First().Accounts; if (!Accounts.Any(r => r.IsChecked == true)) { Accounts.First().IsChecked = true; } AccountRadio.ItemsSource = Accounts; AccountTypeChecked(); } }
public DataDefinitions() { InitializeComponent(); Holder holder = new Holder(); HoldersItems = holder.HolderCollection(); HoldersRadio.DataContext = this; FinancialInstitution financialinstitutions = new FinancialInstitution(); FinancialInstitutions = financialinstitutions.GetFinancialInstitutions(); Accounts = FinancialInstitutions.First().Accounts; if (!Accounts.Any(r => r.IsChecked == true)) { Accounts.First().IsChecked = true; } ReportFormats = Accounts.First().ExcelImportFormats; if (!ReportFormats.Any(r => r.IsChecked == true)) { ReportFormats.First().IsChecked = true; } comboBank.DataContext = this; comboBank.SelectedIndex = 0; AccountRadio.DataContext = this; comboFormat.DataContext = this; comboFormat.SelectedIndex = 0; comboDate.SelectedIndex = 4; Holders.ItemsSource = holder.GetHolders; Categories.ItemsSource = BudgetCategory.GetCategories(); CustomCategories.ItemsSource = BudgetCategory.GetCategories().Concat(new[] { "" }); SetSalaryDatepicker(); DisplayDefaultSalary(); DataGridDefinitions.ItemContainerGenerator.StatusChanged += ItemContainerGenerator_StatusChanged; UpdateDataGrid(); }