private void InitializeComboBox() { List <Sync.BL.Entities.List> cmList; List <Sync.BL.Entities.List> crmList; Client cmClient = cmRepo.GetClients().FirstOrDefault(); cmList = cmRepo.GetLists(cmClient.ClientId); crmList = crmRepo.GetMarketingLists(); this.Dispatcher.Invoke((Action)(() => { Binding cmListBinding = new Binding(); cmListBinding.Source = cmList; CmListComboBox.DisplayMemberPath = "Name"; CmListComboBox.SelectedValuePath = "ListId"; CmListComboBox.SetBinding(ComboBox.ItemsSourceProperty, cmListBinding); Binding crmListBinding = new Binding(); crmListBinding.Source = crmList; CrmListComboBox.DisplayMemberPath = "Name"; CrmListComboBox.SelectedValuePath = "ListId"; CrmListComboBox.SetBinding(ComboBox.ItemsSourceProperty, crmListBinding); })); }
private void InitializeComboBox() { Binding cmListBinding = new Binding(); cmListBinding.Source = cmList; CmListComboBox.DisplayMemberPath = "Name"; CmListComboBox.SelectedValuePath = "ListId"; CmListComboBox.SetBinding(ComboBox.ItemsSourceProperty, cmListBinding); Binding crmListBinding = new Binding(); crmListBinding.Source = crmList; CrmListComboBox.DisplayMemberPath = "Name"; CrmListComboBox.SelectedValuePath = "ListId"; CrmListComboBox.SetBinding(ComboBox.ItemsSourceProperty, crmListBinding); }