Share via


How to: View Compartments in Type Shapes

In Class Designer, you can view the members of types on the class diagram. Compartments within the type shape display the members of the type. For more information about viewing and creating types, see How to: View Existing Types.

Note

On the class diagram, type shapes appear collapsed by default to simplify the view of the diagram. You can expand the type shape to display its contents. However, compartments without members do not appear in the type shape.

Compartment names describe the nature of the type members and depend on the language of the project and the group order selected for displaying those members. For example, if you group type members by kind, compartment names such as Fields, Properties, Methods, and Events might appear in the shape. If you group members alphabetically, only a compartment named Members appears. If you group members by access modifier, compartment names such as Public, Protected, or Private might appear. For more information, see How to: Group Type Members.

To expand or collapse a type shape

  1. From the project in Solution Explorer, open the class diagram (.cd) file.

  2. On the class diagram, select the type shape.

  3. On the Class Diagram menu, choose Expand or Collapse.

    The type shape expands to display its compartments or collapses to hide its compartments.

You can also expand or collapse the shape by clicking the rollup or rolldown button, which appears as a chevron, on the type shape or by right-clicking the type shape and choosing Expand or Collapse from the shortcut menu.

When the type shape is expanded, type shapes show their compartments by default. However, you can hide individual compartments and members within the type shape to emphasize certain aspects of the type on the diagram. Hiding or showing compartments and their members does not affect the code.

To hide a compartment

  1. On the class diagram, expand the type shape if needed.

  2. In the type shape, click the compartment name.

  3. On the Class Diagram menu, choose Hide Compartment.

    The compartment is hidden within the expanded type shape.

You can also right-click the compartment name and choose Hide Compartment from the shortcut menu. You can also select the check boxes in the Hide column of the Class Details window for all members in the compartment to hide the compartment. For more information, see How to: Open the Class Details Window.

To show a compartment

  1. Open or display the Class Details window if it is closed.

  2. In the Class Details window, clear the check box in the Hide column for the compartment you want to show.

    The compartment and its members appear in the type shape on the class diagram.

For more information, see How to: Open the Class Details Window.

See Also

Tasks

How to: View Type Members

How to: View Type Details

Other Resources

Viewing Types and Relationships on Class Diagrams