This project is read-only.

OnLoaded can be invoked multiple times


The TreeViewEx.OnLoaded method can be invoked multiple times without corresponding calls to OnUnloaded. This is a scenario that can happen frequently in WPF (see this for some information)

The problem is that the SelectionMultiple object is created twice, the first one not being disposed. Then, when I try to Ctrl+Click items to add them to selection, it does not work because the selection is toggled twice (so is is selected then immediately unselected) due to the fact that two SelectionMultiple instances are alive.

I fixed the issue on my side by calling OnUnloaded at the beginning of the OnLoaded method.