DarkTreeView SelectedNodesChanged event fired between selection
Kyle-Lancaster opened this issue · comments
I am not sure if below is the intended way for this event to work, if so please close this isssue.
When using the SelectedNodesChanged event on DarkTreeView an additional event is fired when selecting a node. If the darkTreeView.SelectedNodes.Count is queried when this additional event is fired it returns 0 even though a node is busy being selected. This happens even when MultiSelect is set to True and you select multiple nodes one after another using Ctrl.
I am guessing somewhere in the background every time the tree is clicked it is cleared before being reselected?
My work around for this is to check the selected node count and just return if it is set to 0 as my tree will always have at least 1 node selected.
private void darkTreeView_SelectedNodesChanged(object sender, EventArgs e)
{
if (darkTreeView.SelectedNodes.Count == 0) return;
...
}
Also, EventArgs is always null. Not sure if it should contain information.
[Incorrect conclusion on the answer]
Nevermind - DarkTreeView
uses the standard dotnet ObservableCollection
not our custom ObservableList
.
With that in mind this is "intended functionality". It's not great design, but this is how DarkUI reports changes to the SelectedNodes
property due to how ObservableCollection
reports on item changes.