WPF:层次结构问题
我注意到我遇到的问题取决于项目的层次结构。当我不想代表这些项目时,我不知道如何将其子项置于可管理的状态。
我们以 TreeView 为例。当窗口加载时,我可以获取模型并将其放入视图中并作为树的源。然而我似乎对孩子们没有真正的控制权。我唯一能做的就是指向对象的孩子属性,它显示得非常好,但如果我不想在那里编辑、排序和/或添加新项目怎么办,我就不走运了。
我无法真正将子级放入视图或单独的集合中进行修改,因为它们只是根元素的属性。目前我能看到的唯一方法是让属性返回 ObservableCollection 或 CollectionView,但这有它自己的问题,例如没有延迟加载。
你是怎么做的,这里正确的方法是什么,我错过了什么?
I've noticed a problem I'm having depending on the Hierarchy of items. When I wan't to represent the items I have no idea how to put it's children in a manageable state.
Let's take a TreeView for example. When the window is loaded up I can take the model and put it into a view and as a source for the tree. However I seem to have no real control over the children. Only thing I can do is point to the children property of object and it shows up all real nice but what if I wan't to edit, sort and/or add a new item there I'm out of luck.
I can't really put the children into the view or a seperate collection to modify as they are only the property of the root element. Only way I can see at the moment is having the property return a ObservableCollection or a CollectionView and that has it's own problems as in no lazy loading for example.
How are you doing this, what is the proper way here and what am I missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论