This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies.
The Composite UI Application Block lets you create common user interface elements in a shell that components in a module can access. For example, you can create menu items that are accessible from all the SmartParts in a shell. To create and display such user interface elements (UIElements), you use the RegisterSite method of the UIExtensionSites collection of a WorkItem to register the site for a control, and the Add method of a specific UIExtensionSite to display an element.
To add and display elements on the control
- Call the RegisterSite method of the UIExtensionSites collection of the root WorkItem, passing the site name for the element and the control in which it will be located. You need only do this once to register the site. Afterwards, you can add multiple elements to the site by repeating steps 2, 3, and 4.
- In the AfterShellCreated method of your class that inherits from FormShellApplication, declare a local variable of the type of element to display on the control, as shown in the following code.
- Instantiate this variable, passing in the appropriate information for the element type. The following code shows how to instantiate a menu item and specify the text to display on it. Other overloads of the constructor allow you to specify an image.
- Call the Add method of the specific UIExtensionSite, passing in the element you created earlier.
- Repeat steps 2 – 4, as required.