2011-03-21 57 views
0

我使用CAB開發應用程序,我使用的Infragistics CAB擴展套件添加Popuop菜單工具。在CAB主菜單Extention網站

我面對的一個問題。我無法在主菜單中創建彈出式菜單工具。它只顯示我彈出菜單工具文本和圖像,並不顯示子按鈕工具。這裏是我的代碼在主菜單中註冊

PopupMenuTool zoomButton = new PopupMenuTool("Zoom"); 
      zoomButton.SharedProps.AppearancesSmall.Appearance.Image = Properties.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) 

回答

1

我從Infragistics提供的BankTeller樣本中得到了答案。

首先我必須PopupMenuTool.Tools集合註冊到我的UIExtentionSite然後還要在此集合中添加ButtonTools ..

代碼應該是這樣的

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);