private void worker_DoWork(object sender, DoWorkEventArgs e) { EmployeeFactory EFobj = new EmployeeFactory(); this.Dispatcher.Invoke(new Action(delegate { EmployeeGrid.ItemsSource = EFobj.GetAll(); })); }
private void Window_Loaded(object sender, RoutedEventArgs e) { EmployeeFactory obj = new EmployeeFactory(); List <EmployeeViewModel> list = obj.GetAll(); this.Dispatcher.Invoke(new Action(delegate { cbEmployee.ItemsSource = list; cbEmployee.DisplayMemberPath = "E_Name"; cbEmployee.SelectedValuePath = "E_ID"; })); }