WPF Combobox Cascading Updates

I have a list of servers and a separate list of server roles. The name of the server is editable in the servers list. The same list is presented as a combo box in the server roles list. The combobox in the server roles list binds to the same ObservableCollection that the servers list binds to.

Issue:

Whenever a server’s name is updated, the combobox is updated with the new name, however, the selected item still uses the old name.

Example:

old name: local

selected value: local

new name: local2

Combobox item value: local2

Expected selected value: local2

Actual selected value: local

Cause:

I was loading the selecteditems from the disk and the servers were different objects in the server roles list.

Solution

Make sure that the items in the combobox are the same object references as the items in the list.

Advertisements

About vijayvepa

I'm a software consultant for Software Specialists Inc. currently working at Philips Respironics, Pittsburgh

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: