Publish event from Custom ToolStripItem

Topics: CAB & Smart Client Software Factory
Apr 16, 2007 at 3:15 PM
I have created a custom toolstrip item with a textfield and a send button and i want this control to publish a event when it sends the text.
So i created this:

ToolStripTextBar textBar = new ToolStripTextBar();
textBar.Alignment = ToolStripItemAlignment.Right;
WorkItem.UIExtensionSitesConstants.UIExtensionSiteNames.MainToolbar.Add(textBar);

in the usercontrol i publish the event but it doesn't get picked up because it isn't added to the WorkItem it seems.

if i add this code

WorkItem.Items.Add(searchBar);

it works and the event is published within the workitem. Is this the way to go?

The reason im using the EventBroker for this is because i need the text from the textbox to be submitted when the button is clicked and i found no way of doing this through the Command pattern.