private void OnTreeListViewExpanding(object sender, Windows.Controls.Grids.TreeListBoxItemExpansionEventArgs e)
{
if (e.Item is FruitTreeNodeModel fruit)
{
ExpandChildren(fruit);
}
}
private void ExpandChildren(TreeNodeModel node)
{
node.IsExpanded = true;
foreach (var item in node.Children)
{
ExpandChildren(item);
}
}
When the TreeListView is loaded for the first time and all its child nodes are collapsed, I use the above method to expand the child nodes. No matter clicking or double-clicking, it will cause repeated child nodes to appear on the UI, but in fact its number of child nodes is correct. Is this a bug or is my usage wrong?