Skip to content

Instantly share code, notes, and snippets.

@pmalicki11
Last active December 20, 2020 14:05
Show Gist options
  • Save pmalicki11/7cc8fc4a2cfa9ec7a94f08120acd214a to your computer and use it in GitHub Desktop.
Save pmalicki11/7cc8fc4a2cfa9ec7a94f08120acd214a to your computer and use it in GitHub Desktop.
Adding a button tool to the ribbon
/*
Here you can find out how to add some buttons to the form's ribbon and top menus
I strongly recommend check out this too: https://gist.github.com/hasokeric/80534d734d13f431b713045a9dca4f32
*/
using Infragistics.Win.UltraWinToolbars;
UltraToolbarsManager toolbarsManager = this.baseToolbarsManager;
UltraToolbar standardToolbar = toolbarsManager.Toolbars["Standard Tools"];
PopupMenuTool actionsMenu = (PopupMenuTool)toolbarsManager.Tools["ActionsMenu"];
string newButtonID = "newButton";
if(!toolbarsManager.Tools.Exists(newButtonID)) // Check if button does not exist in the ribbon
{
// Create a button object and set its properties
ButtonTool sampleButton = new ButtonTool(newButtonID);
sampleButton.SharedProps.Caption = "Test Button";
sampleButton.SharedProps.Enabled = true;
sampleButton.SharedProps.Visible = true;
sampleButton.SharedProps.AppearancesSmall.Appearance.Image = EpiUIImages.SmallEnabledImages.Images[EpiUIImages.IndexOf("icon")]; // see comment at the end
sampleButton.ToolClick += new Infragistics.Win.UltraWinToolbars.ToolClickEventHandler(sampleButton_Click); // Method to be invoked when button is clicked
toolbarsManager.Tools.Add(sampleButton); // Add button to the menu structure
standardToolbar.Tools.AddTool(newButtonID); // Add button reference to the standard toolbar
actionsMenu.Tools.AddTool(newButtonID); // Add button reference to the actions menu
}
/*
Use the Epicor Resurce Editor
\\YOURSERVER\EpicorXX\Utilities\
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment