TreeView - SelectedItemChanged Event Fired twice when ParentItem gets collapsed


Hi, using the TreeView control within one of my client's project, I noticed something that seems to be a bug. Here is the scenario to reproduce the error:
When a child item of the TreeView is selected and the user collapses the parent item, the item collapsed gets selected. This seems to be an intentional behavior of the TreeView which is kind of logical. However, when this happens, the SelectedItemChanged of the TreeView gets fired twice. The wierdest thing is that, when it is fired the first time, the SelectedItem of the TreeView is the next TreeViewItem placed at the same level as the TreeViewItem collapsed. The second time the event is fired the SelectedItem of the TreeView appears to be the TreeViewItem collapsed.
Am I missing something, or is this really a bug of the TreeView ?
Closed Dec 24, 2008 at 10:47 PM by JustinJosefAngel
Thanks for reporting this.

Closing as duplicate to issue #1116:


shawnoster wrote Nov 3, 2008 at 7:57 PM

Thanks for reporting this. I'm trying to repro but I'm having some difficulty. Would you mind attaching a minimal project that contains the repro, preferable only handling the SelectedItemChanged event?

Another thing to try is running the sample project in the toolkit and in the TreeView on the left go to TreeView -> Basics -> Events and try to reproduce it there. That sample shows all the events fired by the TreeView in a log on the right which should make it very easy to see what events are firing when.

wrote Nov 3, 2008 at 7:57 PM

wrote Dec 24, 2008 at 10:47 PM

wrote Feb 22, 2013 at 1:54 AM

wrote May 16, 2013 at 12:36 PM