Testing for successful ActivateItem call

Topics: UI Architecture
Jan 27, 2015 at 12:43 PM
I've inherited some code which contains a bug. There is a view model which inherits from Conductor<T>, and the view model for this view contains a listbox - selecting an item from the listbox causes a call to ActivateItem. The activated items implement CanClose.

ActivateItem seems to call CanClose, and ultimately abort if CanClose returns false, but since ActivateItem is a void with no return value, I don't know whether the activation was cancelled and therefore I can't cancel the listbox selection and as such, I end up with a mismatch between the selected item and the details view displayed

This seems like such a fundamentally common requirement that I'm assuming there is a fairly simple way to achieve it - could anybody point me in the right direction?