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
135
Modifying toolbarItemButtons in Ribbon
posted

Hi,

I would like to know is there any way we can change the size and style of toolbarItembuttons in the ribbon control.Is it possible to give different colors to the buttons in the quick acess toolbar and buttons inside the ribbon footer section?

Parents
  • 21795
    Verified Answer
    Offline posted

    Hello Sijo,

    Yes, you can style most of the parts of UltraToolbarsManager, including the ribbon. One way to do this is to set various appearances of the different parts of this component. The other way is to create your own style library with Infragistics AppStylist application and to apply it to your project. Here is a sample showing how you can style a tool in the ribbon:

    //  Get the ribbon tab containing the ribon group with the tool we need to style
    var ribbonTab = this.ultraToolbarsManager1.Ribbon.Tabs["ribbon1"];

    //  Get the ribbon group then
    var ribbonGroup = ribbonTab.Groups["ribbonGroup1"];

    //  Finally get the tool from the group
    var buttonTool = ribbonGroup.Tools["ButtonTool3"];

    //  Add image to tool's shared props. This will apply the image to all the instances
    //  of the tool, e.g. the same image will be shown in the QAT
    buttonTool.SharedProps.AppearancesLarge.Appearance.Image = this.toolImage;
    buttonTool.SharedProps.AppearancesSmall.Appearance.Image = this.toolImage;

    //  Set some propertues to this instance of the tool through InstanceProps. This will
    //  not affect the other instances of the tool
    buttonTool.InstanceProps.MinimumSizeOnRibbon = Infragistics.Win.UltraWinToolbars.RibbonToolSize.Large;
    buttonTool.InstanceProps.AppearancesLarge.Appearance.BackColor = Color.Red;
    buttonTool.InstanceProps.AppearancesLarge.Appearance.BackColor2 = Color.Red;
    buttonTool.InstanceProps.AppearancesLarge.Appearance.ForeColor = Color.White;
    buttonTool.InstanceProps.AppearancesLarge.HotTrackAppearance.BackColor = Color.Green;
    buttonTool.InstanceProps.AppearancesLarge.HotTrackAppearance.BackColor2 = Color.Green;
    buttonTool.InstanceProps.AppearancesLarge.HotTrackAppearance.ForeColor = Color.Black;

    Regarding the size of the button tools you cannot set or change it. The size of the button tools is determined automatically. What you can do set is the MinimumSizeOnRibbon property of the tool.

    To style the footer toolbar of the application menu you may use same approach as the one with tools. You can style this area by setting different appearances or by the help of AppStylist. Here is how you can do this at run time:

    //  Style the footer of the application menu
    this.ultraToolbarsManager1.Ribbon.ApplicationMenu.FooterToolbar.Settings.Appearance.BackColor = Color.Aquamarine;
    this.ultraToolbarsManager1.Ribbon.ApplicationMenu.FooterToolbar.Settings.Appearance.BackColor2 = Color.Aquamarine;

    Attached is a small sample project showing how you can style these areas at run time. Note you can achieve the same and in design time.

    Please let me know if you have any additional questions.

    UltraToolbarsManagerStyling.zip
Reply Children
No Data