UIExtensionSites.RegisterSite problem

Topics: CAB & Smart Client Software Factory
Nov 30, 2006 at 10:30 AM
originally posted by: alexsantos


I have a MDI application, so for each Window I create a toolbar and uses RegisterSite for it...like :


My customer can open many MDIs about same information. Each MDI has own WorkItem.

The problem is even using a WorkItem for each MDI I can't register UIExtension with same names...remember ! Same names but different WorkItem...

My question is : UIExtensionSites is global ? How to register an UIExtensionSites only for that WorkItem ?

Alexnaldo Santos
Nov 30, 2006 at 12:35 PM
originally posted by: Tex47


UIExtensionSites are bound to the current WorkItem where they will be registered. To make those global, u have to use the RootWorkItem.

class SmartPartApplication : FormShellApplication<WorkItem, MainForm>

protected override void AfterShellCreated()
RootWorkItem.UIExtensionSites.RegisterSite("MainMenu", this.Shell.MainMenuStrip);

Hmm, to register those UIExtensionsSites for a special WorkItem, you have to find this special WorkItem from the Items list and than register the controls.
To find this specific Workitem, u have to register this WorkItem at the RootWorkItem and just find it by its ID, otherwise, u have to use a recursive search from the RootWorkItem -> ModuleWorkItem -> your Special Workitem for the Form, which requires, that tis WorkItem has been instanced. You could also use the ModuleWorkItem for registering, that make it local to the module, and the ModuleWorkItem would be the Parent of the MDI WorkItem.