ListControl OnSelectionChanged

Sep 14, 2010 at 11:38 PM

Hi,

Just downloaded the latest version of from the SVN, also checked the behaviour against the source and it seems consistent with what I see there.

Got a ListControl set to single selection only. Overriden the OnSelectionChanged method to handle a selection change. Issue is that when a selection is changed this method is called 3 times, and the first time there the SelectedItems list is empty.

I believe this is due to the behavouir in the OnRowClicked method which clears and repopulates the SelectedItems list, which fires the method twice via the events attached to this list, and then manually calls the method again.

Is this behaviour intentional?

Coordinator
Sep 20, 2010 at 1:21 PM

No, that wasn't intentional at all.

I wonder why my unit tests didn't catch that. NMock should raise an exception if a callback is invoked more often than expected...

I'll fix this in the upcoming release. The correct behavior is (of course) to fire the event just once after the contents have changed.

Nov 14, 2012 at 5:29 PM

 

Hey, this bug remains since 2010? I have the same problem, ill have to change the source

Feb 19, 2013 at 1:00 PM
By the way - OnSelectionChanged is not fired when SelectedItems collection is changed from code. Was that intentional?