how to get RemovedItems or AddedItems from combobox?
what could be done if i want to get the r开发者_JS百科emoved itema dn added items from a comboBox?
In any case bind your ComboBox's SelectedItem to a property in your ViewModel. The changes could be done to that property in the setter.
Foo _selectedItem;
public Foo SelectedItem
{
get
{
return _selectedItem;
}
set
{
oldvalue = _selectedItem; // Do something with the previously SelectedItem
_selectedItem = value; // Do something with the newly SelectedItem
// PropertyChange Notification goes here
}
}
What are you using for binding the items of the combobox? if you are using a ObservableCollection
you can use the CollectionChanged
event to be notified of those changes. And it would all be done in the ModelView layer were you probably want to.
精彩评论