Is it wrong to access TreeViewItems in WPF’s TreeView?

前端 未结 4 742
半阙折子戏
半阙折子戏 2021-01-26 15:00

I’ve been having issues with the TreeView in WPF. This control makes it very hard to access the TreeViewItems it’s showing.

On several occasion

4条回答
  •  旧时难觅i
    2021-01-26 15:54

    No, I dont see in what way accessing the items of a treeview is wrong.

    I think the difficulties you are encountering are because you aren't seeing the treeview as it should be.

    A leaf has a parent, but no children. A node can have a parent, and can have children. A node without a parent is a root.

    Based on these principles (SourceMaking Composite pattern) you should be able to do whatever you want using recursivity. (in both XAML and code)

提交回复
热议问题