Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
205
Programmatically adding tools to ribbon
posted

 Hi,

I am trying to add buttons to a group in a tab using the following code and then set them to be large buttons that i can add an image to. I can't see any way to get this to work, does anyone have any ideas?

//create tools

            ButtonTool _btnTest1 = new ButtonTool("Test1"); ;

            ButtonTool _btnTest2 = new ButtonTool("Test2"); ;

            ButtonTool _btnTest3 = new ButtonTool("Test3"); ;

 

            _btnTest1.SharedProps.Caption = "TEST1";

            _btnTest1.InstanceProps.MinimumSizeOnRibbon = RibbonToolSize.Large;

            //_btnTest1.InstanceProps.AppearancesLarge.Appearance.Image = WindowsApplication5.Properties.Resources.LEA1;

            _btnTest1.InstanceProps.MinimumSizeOnRibbon = RibbonToolSize.Large;

            _btnTest1.InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Large;

 

            _btnTest2.SharedProps.Caption = "TEST2";

            _btnTest2.InstanceProps.MinimumSizeOnRibbon = RibbonToolSize.Large;

            //_btnTest2.InstanceProps.AppearancesLarge.Appearance.Image = WindowsApplication5.Properties.Resources.LEAHat;

            _btnTest2.InstanceProps.MinimumSizeOnRibbon = RibbonToolSize.Large;

            _btnTest2.InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Large;

            

            _btnTest3.SharedProps.Caption = "TEST3";

            _btnTest3.InstanceProps.MinimumSizeOnRibbon = RibbonToolSize.Large;

            //_btnTest3.InstanceProps.AppearancesLarge.Appearance.Image = WindowsApplication5.Properties.Resources.person1;

            _btnTest3.InstanceProps.MinimumSizeOnRibbon = RibbonToolSize.Large;

            _btnTest3.InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Large;

 

            //add tools to root collection

            TBM_Test.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[ { _btnTest1, _btnTest2, _btnTest3 });

 

            //add tabs and groups to the ribbon

            TBM_Test.Ribbon.CaptionAreaActiveAppearance.BackColor = System.Drawing.Color.DarkSeaGreen;

            TBM_Test.Ribbon.Tabs.Add("Boundaries");

            TBM_Test.Ribbon.Tabs["Boundaries"].Groups.Add("BoundaryGroup");

            TBM_Test.Ribbon.Tabs.Add("Addresses");

            TBM_Test.Ribbon.Tabs["Addresses"].Groups.Add("AddressesGroup");

 

            //add tools to the tabs

            TBM_Test.Ribbon.Tabs["Boundaries"].Groups["BoundaryGroup"].Tools.AddTool("Test1");

            TBM_Test.Ribbon.Tabs["Addresses"].Groups["AddressesGroup"].Tools.AddTool("Test2");

            TBM_Test.Ribbon.Tabs["Addresses"].Groups["AddressesGroup"].Tools.AddTool("Test3");

 

            TBM_Test.UseLargeImagesOnToolbar = true;

            TBM_Test.UseLargeImagesOnMenu = true;

 Thanks

Parents
No Data
Reply
  • 205
    Verified Answer
    posted

    I'll answer this one myself - you need to set the preferred size at the group level

    e.g TBM_Test.Ribbon.Tabs["Addresses"].Groups["AddressesGroup"].PreferredSizeOnRibbon = RibbonToolSize.Large;

    Is this correct? Its a little confusing if so as its the items not the group that we are displaying large? Should it not be something like TBM_Test.Ribbon.Tabs["Addresses"].Groups["AddressesGroup"].Items.PreferredSizeOnRibbon = RibbonToolSize.Large;?

Children