In This Topic
The members of a node (i.e. its properties and child slots) are hierarchically organized in categories. Categories are strings in which sub-categories are divided by the . (dot) character. For example consider the following editor of the Diagram Shape - Geometry element:
fig. 1 Member Categories
The FillRule property is a member of the General.Filling and Rounding category, which also contains the CornerRounding property. The General.Filling and Rounding category is a child category of the General category, which also contains the General.Behavior and General.End Points Direction sub-categories.
Assigning Members to Categories
You can assign members (properties and child slots) to categories by using the NDesigner-SetMemberCategory method. The following code shows how the NGeometry properties are distributed to categories:
Assigning Members to Categories |
Copy Code
|
public class NGeometryDesigner : NDesigner
{
public NGeometryDesigner()
{
// general - behavior
SetMemberCategory(ClipWithTextBlockProperty, "General.Behavior");
SetMemberCategory(ClipWithImageBlockProperty, "General.Behavior");
// general - filling and rounding
SetMemberCategory(FillRuleProperty, "General.Filling and Rounding");
SetMemberCategory(CornerRoundingProperty, "General.Filling and Rounding");
// general - end points direction
SetMemberCategory(BeginDirectionProperty, "General.End Points Direction");
SetMemberCategory(EndDirectionProperty, "General.End Points Direction");
}
}
|
Category Editors
You can assign different editors to the categories via the NDesigner - SetCategoryEditor method. For example, in the context of our NGeometry example, the General and Appearance categories are displayed in tab, while the sub-categories of the General category are embedded in group boxes. In code this is achieved with the following code:
Setting Category Editors |
Copy Code
|
public class NGeometryDesigner : NDesigner
{
public NGeometryDesigner()
{
// set category editors
SetCategoryEditor(string.Empty, NTabCategoryEditor.HeadersTopTemplate);
SetCategoryEditor(General_Category, NStackCategoryEditor.VerticalEmbedChildEditorsTemplate);
}
}
|
For more information see the Category Editors topic.
Ordering Members and Categories
The editors of the browsable members inside each category are by default ordered by their Original Title (non-translated). You can control the order of the items in each category by settings an editor comparer to each specific category via the NDesigner - SetCategoryEditorsComparer method. For example the following code snipped explicitly orders the NGeometry categories, so that the General category appears before the Appearance category:
Explicitly Ordering Editors |
Copy Code
|
public class NGeometryDesigner : NDesigner
{
public NGeometryDesigner()
{
// explicitly order editors
SetCategoryDisplayOrder(General_Category, 0);
SetCategoryDisplayOrder(Appearance_Category, 1);
SetCategoryEditorsComparer(string.Empty, NEditorComparer.DisplayOrder);
}
}
|
The different ordering types are discussed in detail in the Editor Comparers topic.