private void BtnSua_Click(object sender, RoutedEventArgs e) { CauHoi temp = ((Button)sender).DataContext as CauHoi; Sua sua = new Sua(temp); sua.ShowDialog(); if (sua.isChange()) { lsvCauHoi.ItemsSource = DataProvider.Instance.GetLstCauHoi(); } }
public Sua(CauHoi Cauhoi) { InitializeComponent(); this.Cauhoi = Cauhoi; cbTheLoai.ItemsSource = DataProvider.Instance.GetTheLoai(); //cbTheLoai.DisplayMemberPath = "TheLoai"; //cbTheLoai.SelectedValuePath = "TheLoai"; cbTheLoai.SelectedValue = Cauhoi.MaTheLoai; txbCauHoi.Text = Cauhoi.NoiDung; txbDapAnA.Text = Cauhoi.DapAnA; txbDapAnB.Text = Cauhoi.DapAnB; txbDapAnC.Text = Cauhoi.DapAnC; txbDapAnD.Text = Cauhoi.DapAnD; }