Microsoft
Software
Hardware
Network
Question : Binding ComboBox to ObserveableCollection: SelectedItem after deleting item from Collection
Hello,
In Silverlight 3, I have a ComboBox whose ItemsSource is set to an ObserveableCollection with possible Selections, while the SelectedItem is bound to a property to keep track of the current selection.
When I delete an item from the ObserveableCollection, everything works fine and the item disappears from the ComboBox-Dropdown-List as expected, but, if the the deleted item was selected before, SelectedItem becomes null.
Is there any way to automatically set SelectedItem to another Item from the Collection (if available) when the original item was deleted, so it won't become null?
Answer : Binding ComboBox to ObserveableCollection: SelectedItem after deleting item from Collection
You can bind SelectedItem to property which will be in ViewModel. Then for that property you will act for SETter. If value equals null then you will try to find another item.
Random Solutions
Quicker way of adding computers/users to OU?
Not enough memory error on trying to open Access database
Remove Quick Launch
Can I install SQL 2005 32-bit on Windows Server 2003 64-bit?
Reference option button
Drivers for SATA HP XW4600T does not work when I create a custom XP cd?
Week Number in DOS
'Day' is a type and cannot be used as an expression
Error in Virtual PC 2007 when trying to startup an XP machine
How do I configure my DHCP server correctly in this network?