Hello,
I'm trying to get a list of all selected nodes.
I found GetNodesFromItems method, but it always returns empty result even when SelectedDataItems is not empty:
if (sender is XamDataTree dataTree && e.OriginalSource is TextBlock) { var selectedNodes = dataTree.GetNodesFromItems(dataTree.SelectedDataItems, false); }
Am I doing something wrong?
You're right , it works with recursive flag set to true.
Then it means I misunderstood the flag meaning. I thought it means if the result should include all the children of matched elements.
Hello Alexis,
Thank you for your post. The GetNodesFromItems method returns empty collection because your set the 2nd parameter(recursive) to false.
I set up a small demo sample using GetNodesFromItems method and it is returning selected node collection as expected.
Refer the sample and let me know of you have any question.
Sincerely,
Divya Jain
7536.Sample.zip