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?
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 stylevar ribbonTab = this.ultraToolbarsManager1.Ribbon.Tabs["ribbon1"]; // Get the ribbon group thenvar ribbonGroup = ribbonTab.Groups["ribbonGroup1"]; // Finally get the tool from the groupvar 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 QATbuttonTool.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 toolbuttonTool.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;
// Get the ribbon group thenvar ribbonGroup = ribbonTab.Groups["ribbonGroup1"];
// Finally get the tool from the groupvar 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 QATbuttonTool.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 toolbuttonTool.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 menuthis.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.
Thanks Milko!