Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我知道如果我将 TreeNode 子类化,那么我可以将它添加到 TreeView 中的 Nodes 集合中。但是,我目前正在处理的 TreeView 是数据绑定的,有没有办法告诉 TreeView 它的节点应该是什么类型?
纳克斯,
乔
弄清楚了。只需继承 TreeView 并覆盖 CreateNode 方法。
public class PermissionsTreeView : TreeView { protected override TreeNode CreateNode() { return new PermissionsTreeNode(); } }