开发者

Add Popuop menu tool in CAB Main Menu Extention site

开发者 https://www.devze.com 2023-02-18 14:14 出处:网络
I am developingapplication using CAB and i am using Infragistics CAB Extensibility kit. I am facing one problem. i am unable to create Popup menu tool in Main menu. It shows me only Popup menu tool t

I am developing application using CAB and i am using Infragistics CAB Extensibility kit.

I am facing one problem. i am unable to create Popup menu tool in Main menu. It shows me only Popup menu tool text and image and does not show Child button tools. here is my code to register in Main Menu

PopupMenuTool zoomButton = new PopupMenuTool("Zoom");
            zoomButton.SharedProps.AppearancesSmall.Appearance.Image = Propert开发者_如何学Cies.Resources.bmw_m32;
            zoomButton.SharedProps.DisplayStyle = ToolDisplayStyle.ImageAndText;
            zoomButton.SharedProps.Caption = "Zoom";

            zoomButton.DropDownArrowStyle = DropDownArrowStyle.Segmented;
            // Specifies the Popup Style as Menu
            zoomButton.Settings.PopupStyle = PopupStyle.Menu;


            var zoom1X = new ButtonTool("GZoom1");
            zoom1X.SharedProps.DisplayStyle = ToolDisplayStyle.TextOnlyAlways;
            zoom1X.SharedProps.Caption = "Lavel 1";


            zoomButton.Tools.Add(zoom1X);

            WorkItem.UIExtensionSites[Constants.UIExtensionSiteNames.MainMenu].Add(zoomButton)


I got the answer from BankTeller sample provided by infragistics.

First i have to Register PopupMenuTool.Tools collection to my UIExtentionSite and then have to add ButtonTools in this collection..

Code should be like this

PopupMenuTool zoomButton = new PopupMenuTool("Zoom");
            zoomButton.SharedProps.AppearancesSmall.Appearance.Image = Properties.Resources.bmw_m32;
            zoomButton.SharedProps.DisplayStyle = ToolDisplayStyle.ImageAndText;


            // Specifies the Popup Style as Menu
            zoomButton.Settings.PopupStyle = PopupStyle.Menu;
            zoomButton.DropDownArrowStyle = DropDownArrowStyle.Segmented;
            WorkItem.UIExtensionSites[Constants.UIExtensionSiteNames.MainToolbar].Add(zoomButton);

            WorkItem.UIExtensionSites.RegisterSite("ZoomTools", zoomButton.Tools);

            ButtonTool zoom1X = new ButtonTool("Zoom 1 X");
            zoom1X.SharedProps.Caption = "Level 1";
            WorkItem.UIExtensionSites["ZoomTools"].Add(zoom1X);
0

精彩评论

暂无评论...
验证码 换一张
取 消