Framework / Editors / Designers / The Node Designer
In This Topic
    The Node Designer
    In This Topic

    Designers are represented by instances of the NDesigner class. There is a designer associated with each NNode Schema. If not explicitly specified, by default an instance of the NDesigner class is created to serve as node designer.

    Designers provide information about the editors that need to be created for certain schema members, the editors that need to be created when the node is the root edited node, or is edited as part of other nodes hierarchy etc. The relation between the designer and the node editors is discussed in the Designers and Editors topic.

    Designers also define node members (properties and container children) categorization. This allows the user to see related members grouped together in their respective categories (e.g. - General, Appearance, Behavior are common categories used to group node members).  The Member Categories topic discusses this in details.

    Designers also provide a set of actions that are commonly performed with the node instance, as discussed by the Commands and Verbs topic.

    The rest of this topic focuses on how to assign a custom designer to a node schema.

     Assigning a Custom Designer to a Node Schema

    You can assign a designer to a specific type of nodes (i.e. nodes that are associated with a specific Schemas), by setting a value for the NDesignerMetaUnit (see Meta Units for more info).

    The following example assigns the MyNodeDesigner designer to all instances of the MyNode class:

    Assigning a Custom Node Designer
    Copy Code
    public class MyNode : NNode
    {
        public MyNode() { }
        static MyNode()
        {
            MyNodeSchema = NSchema.Create(typeof(MyNode), NNode.NNodeSchema);
            // set designer type for MyNode
            MyNodeSchema.SetMetaUnit(new NDesignerMetaUnit(typeof(MyNodeDesigner)));
        }
        public static readonly NSchema MyNodeSchema;
        public class MyNodeDesigner : NDesigner
        {
            public MyNodeDesigner()
            {
                // TODO: Init designer here
            }
        }
    }
    

    As seen in the example, the MyNodeDesigner must derive from the NDesigner class.

     Getting a Designer for a Node Schema

    If you want to get the designer, that is currently associated with a node schema, you can use the NDesigner.GetDesigner static method as shown in the following example:

    Getting a Designer for a Node Schema
    Copy Code
    // get the designer for nodes of type MyNode
    NDesigner myNodeDesigner = NDesigner.GetDesigner(MyNode.MyNodeSchema);
    

    In the context of the previous example, the returned designer instance will be of type MyNodeDesigner.