Problem with loss of ToolStrip item properties

Topics: CAB & Smart Client Software Factory
Dec 15, 2005 at 8:29 AM
originally posted by: SkreetchinTires

I am having problems with ToolStripLabels and ToolStripTextboxes having their custom width properties being reset to the default of 100 as subsequent items are added to the UIExstensionSite (a ToolStrip) of the shell application. The problem happens when the items are built and added to the UIExtensionSite during subsequent calls in the overridden Load method of the derived ModuleInit class. The problem does not happen if the items are added after the application is up (i.e., by responding to a click event).

My objective is to have multiple modules with different use cases within the shell. Each module has its own set of ToolStrip items. The modules subscribe to a topic provided by the shell to manage their visability. Here is how I have currently implemented the module initialization. I need to know if a more appropriate practice will solve this issue, or if this is an issue.

In the ModuleInit derived class:

public override void Load()

NavigationWorkItem navigationWorkItem = parentWorkItem.WorkItems.AddNew<NavigationWorkItem>();

In NavigationWorkItem:

public void Show(IWorkspace SidebarWorkspace, IWorkspace ContentWorkspace)
contentWorkspace = ContentWorkspace;

navView = Items.AddNew<NavigationView>();

TabSmartPartInfo info = new TabSmartPartInfo();
info.Title = "PrintData";

SidebarWorkspace.Show(navView, info);

navView.AddToolStripItems(RootWorkItem.UIExtensionSites"ToolStrip", this);

In NavigationVew class:

public void AddToolStripItems(UIExtensionSite Site, WorkItem ContainerWorkItem)
if (butGo == null)

Site.Add(txtServer); // This causes lblServer to reset its width property
Site.Add(lblLocator); // This causes txtServer to reset it width property
Site.Add(txtLocator); // This causes lblLocator ...
Site.Add(butGo); // This causes txtLocator ...
ContainerWorkItem.Commands"butGo".AddInvoker(butGo, "Click");
myController.State"ToolStripItemsAdded" = true;


So far, this design allows for any number of different development groups to create thier own modules which can be presented in the shell application. Is there is a 'Best Practices' for doing this which would solve my issue?