We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

ToolBar

Hi,

I want to create a ToolBar which has dynamically created Toolbar items and on click of ToolbarItem i want to pass a value depending on toolbaritem.
Is there any sample for dynamically creating toolbar and passing parameters to the toolbaritem method.

Thanks & Regards
Ajay

4 Replies

PR Purusothaman R Syncfusion Team September 18, 2006 10:07 PM UTC

Hi Ajay,

The Toolbar can be created dynamically through the code, by initializing MainFrameBarManager, ParentBarItems and Bar Items in the Form''s Constructor.

I have attached a sample to illustrate the creation of tool bars dynamically and handling its click event.

Please let me know, whether this is what you actually needed.
Thanks for using Syncfusion Products.

http://www.syncfusion.com/Support/user/uploads/ToolbarCode_9561084f.zip

Regards,
Purusothaman.R


AB Ajay Bhalegar September 19, 2006 05:15 PM UTC

Hi Purusothaman,



AB Ajay Bhalegar September 19, 2006 05:20 PM UTC

Hi Purusothaman,

I tried using your sample it is quite similar to what my requirement are, but in your sample you are showing it using MainFrameBarManager , but i have a contextmenu which has multiple bar items on whose click it should open a form depending on the barItem.

I tried with PopupMenusManager.SetXPContextMenu
but this requires a control, but in my case i dont have any control its a toolbar so its not working.

Is there any way to show in context menu.

Thanks & Regards
Ajay


PR Purusothaman R Syncfusion Team September 19, 2006 09:38 PM UTC

Hi Ajay,

Multiple bar items can be added to the Context Menu during runtime through code and also their click event can be handled depending on the Bar Item.

The Popup Menu can be attached to the Form by setting the "SouceControl" property of the PopupMenu to the Form and display it using show method on MouseUp event. This excludes the usage of PopupMenusManager. Here is the code snippet.

PopupMenu1.SourceControl = this;

The second and recommended method to associate the Popupmenu with the form is, to use the following snippet.

popupMenusManager1.SetXPContextMenu(this, PopupMenu1);

No other control is needed to associate the context menu with the form.

A sample has been attached here and please let me know if this helps.

PopupCode.zip


Thanks for using Syncfusion Products.

Regards,
Purusothaman.R

Loader.
Live Chat Icon For mobile
Up arrow icon