In my program, I would like to get all the children of the parent node so that I can add a new node to it. In the past, I used this approach:
var node = ObservableCollection.GetAllChildren(x => x.Children).Distinct().ToList().First(x => x.DisplayName == nameOfNode);
node.Children.Add(CreateNode(newNodeName));
Now I would like GetAllChildrenfrom my property SelectedItem, which is fully functional. Can this be done using the method GetAllChildren? If so, how?
Addition 1:
The My property SelectedItemis of type ViewModel. ObservableCollectionalso has a type ViewModel, so basically SelectedItemthe program selected by ViewModel is indicated.
Addition 2:
I canβt just add a Node parent. I have to check how many children there are for other reasons in this program before adding.
source
share