private void Fill_comboboxes() { foreach (CompanyModel company in CompanyProcessor.data) { Models.ComboBoxItem item = new Models.ComboBoxItem(); item.Content = company.companyName; item.Value = company.id; companyId.Items.Add(item); } }
private void EmployeeId_SelectionChanged(object sender, SelectionChangedEventArgs e) { employeeId.Items.Clear(); employeeId.Visibility = Visibility.Visible; employeeText.Visibility = Visibility.Visible; int companyIdd = Convert.ToInt32((companyId.SelectedItem as Models.ComboBoxItem).Value.ToString()); List <RepresentativeModel> tempRepList = RepresentativeProcessor.data.Where(item => item.companyId == companyIdd).Select(item => item).ToList(); foreach (RepresentativeModel representative in tempRepList) { Models.ComboBoxItem item = new Models.ComboBoxItem(); item.Content = representative.name + " " + representative.surname; item.Value = representative.id; employeeId.Items.Add(item); } }