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
Unable to remove buritos.exe trojan from UPS email
SBS 2003 Error - Windows could not start because of an error in the software. Please report this problem as : load needed DLLs for kernel.
MS Access onto a websever
Does waiting for a web service's reponse use "clock cycles"?
How to use CDatabase's ExecuteSQL to find the record or row and then get the result, such as in CRecordSet
There isn't enough memory to perform this operation
replace field value with another value using MS TSQL
SystemDB and MDW questions
How to restore Windows 7 Home Premium?
OSC 2007 R2, need to deploy a FQDN pool. not sure how to