WPF TreeView 使子节点可单击
我正在制作一个包含 TreeView 的 WPF 程序。 我现在遇到问题了。 我正在使用附加的命令行为来尝试打开 TreeView 子树视图项。
基本上,treeView 项目包含一个 ID,当您双击它时。 它将打开另一个窗口,显示与该 ID 相关的详细信息。
现在,问题是。当我双击树视图项目时,它不会执行任何操作。但是当我双击树视图项目的外部时,我的命令实际上被击中了。
据我观察。当您双击父节点时,它会展开或折叠子节点。
无论如何,您是否可以覆盖或禁用此命令?提前致谢!!!
I am making a WPF program that contains a TreeView.
I am having a problem right now.
I am using an attached command behavior to try to open a TreeView children tree view item.
Basically, the treeView item contains an ID and when you double click it.
It will bring another window up showing the details that are associated with this ID.
Now, the problem is. When i double click a treeView item, it doesn't do anything. But when i double click the outside of the treeview item, my command actually gets hit.
From what i have noticed. When you double click the parent node, it expands or collapses the children nodes.
Is there anyway by anychance, where you can either over ride or disable this command? Thanks in advance!!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,
我正在使用 NHibernate,并将所有项目包装在带有 ID 等的类型对象的 VmCollection 中。每个对象都有自己的 ID。因此,我在 XAML 中传递对象并在 ID 匹配时检查 ID。我打开一个新窗口,其中包含前一个对象中的所有相同信息。
这是在列表视图的鼠标双击事件中处理的。因为 TreeView 只是一个具有层次结构的 ListView。它应该具有与列表视图相同的所有属性。
Well,
I am using NHibernate and I wrapped all my items in a VmCollection of a type object with ID and etc. Each object has it's own ID. So, I am passing in the object in XAML and checking for the ID, when the id matches. I open up a new window with all of the same information that was in the previous object.
This was handled in the Mouse Double Click event that is the List View. And since a TreeView is just a ListView with a Hierarchy. It should have all the same properties as the list view.