public void ListTypeBenneEngin() { var l = TypeBenneEngin.getAll(); foreach (var item in l) { LoadCombo lCombo = new LoadCombo(); lCombo.Id = item.Id; lCombo.Libelle = item.Libelle; ListCmbTypeBenneEngins.Add(lCombo); } cmbTypeBenne.ItemsSource = ListCmbTypeBenneEngins; }
private void BtnModifier_Click(object sender, RoutedEventArgs e) { try { BenneEngin Tab = TabBenneEngin.SelectedItem as BenneEngin; var T = BenneEngin.getUnBenneEngin(Tab.Id); Id = T.Id; txtMatricule.Text = T.Matricule; txtMarque.Text = T.Marque; txtCapacite.Text = T.Capacite.ToString(); txtAnneeAchat.Text = T.AnneeAchat.ToString(); var c = ListCmbTypeBenneEngins.SingleOrDefault(a => a.Id == T.IdTypeBenne); int val = ListCmbTypeBenneEngins.IndexOf(c); cmbTypeBenne.SelectedIndex = val; BtnNouveau.IsEnabled = false; DegriserChamps(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }