简体   繁体   中英

ComboBox not binding on WCF callback

I'm creating a sample chat application.

On Form load, WCF service is called. -- here user's callback is registered at wcf service, added to a UserList

Other users are notified about the current users by sending the UserList to them using their callback. Callback cals UpdateClientList method at client side.

WCF service is able to call the Client's method " UpdateClientList(List<PropUser> listuser) ".

But, inside the method even following hard-coded lines are not able to bind them:

List<PropUser> listuser = new List<PropUser>();
            listuser.Add(new PropUser { Id = "1", Name = "Ram" });
            listuser.Add(new PropUser { Id = "2", Name = "Shyam" });
            listuser.Add(new PropUser { Id = "3", Name = "Ramam" });

            comboBox1.DisplayMember = "Name";
            comboBox1.ValueMember = "Id";
            comboBox1.DataSource = listuser;

even comboBox1.Enabled= false; is not working

MessageBox.Show("Hi"); is working.

Note: it is windows application not web
Please suggest:

When you added reset the datasource do you call the update method on the Combobox ?

If you used a binding source as the intermediary - you could call ResetBindings(false); That would do the trick for you.

However in your scenario - you need to refresh your combobox by calling the Update() method on the box, combobox1.Update();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM