I want to put ButtonTool in the large round button in the upper-left corner of the Ribbon (actually this is the RootToolsCollection ). When I try to do it it throws exception the there is no UI Adapter to handle RootToolsCollection. How can I do this to work?
Now I have the following problem - When I try to add ButtonTool in RibbonGroup it adds button but doesn't show the picture. This is the code that I use for this:
RibbonGroup actionTabGroup = new RibbonGroup("actionTabGroup", "Group 1 in Tab 2"); RootWorkItem.UIExtensionSites["ribbonTab1Groups"].Add(actionTabGroup); ; RootWorkItem.UIExtensionSites.RegisterSite("actionTabGroupTools", actionTabGroup.Tools); // Create a ButtonTool and add it to ribbonTab2Group1 Infragistics.Win.Appearance addAppearance = new Infragistics.Win.Appearance(); addAppearance.Image = Properties.Resources.add; addAppearance.ImageVAlign = Infragistics.Win.VAlign.Top; ButtonTool addButton = new ButtonTool("ribbonTab2Group1Button2"); addButton.SharedProps.DisplayStyle = ImageAndText; addButton.SharedProps.Caption = "Add"; addButton.InstanceProps.MinimumSizeOnRibbon = Infragistics.Win.UltraWinToolbars.RibbonToolSize.Large; addButton.InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Large; addButton.SharedProps.AppearancesLarge.Appearance = addAppearance; RootWorkItem.UIExtensionSites["actionTabGroupTools"].Add(addButton);
Thanks. It works!
You wouldn't want to add to the root tools collection. You would instead register a site for the ToolAreaLeft of the Ribbon.ApplicationMenu. Then you can add tools to that.