Also just for the sake of snippets… You can also add a Dropdown to the Standard Tools and some other stuff.
private void SetupToolbarItems()
{
// Get The Main Toolbar
UltraToolbar mainToolBar = this.baseToolbarsManager.Toolbars["Standard Tools"];
// Remove the Single NewTool Button from the Toolbar Root
mainToolBar.Tools.Remove(mainToolBar.Tools["NewTool"]);
// Make Epicors Popup Tool NewMenuTool Visibile (most forms have this hidden by default)
baseToolbarsManager.Tools["NewMenuTool"].SharedProps.Visible = true;
// Hide the Save Button since we will not allow Saving
baseToolbarsManager.Tools["SaveTool"].SharedProps.Visible = false;
// Hide the Delete Tool since will not allow Deleting
baseToolbarsManager.Tools["DeleteTool"].SharedProps.Visible = false;
// Hide the Search Tool since we will not allow Searching
baseToolbarsManager.Tools["SearchTool"].SharedProps.Visible = false;
// Make others Visible or Invisible
baseToolbarsManager.Tools["PrintTool"].SharedProps.Visible = true;
// Remove these Items from the Toolbar but not from the Actions Menu
string[] arMainTools = new string[6] {"CutTool", "RefreshTool", "CopyTool", "PasteTool", "UndoTool", "AttachmentTool"};
foreach (string tool in arMainTools)
{
mainToolBar.Tools.Remove(mainToolBar.Tools[ tool ]);
}
// WIP: Skids
Infragistics.Win.UltraWinToolbars.ComboBoxTool comboSkidCountTool = new Infragistics.Win.UltraWinToolbars.ComboBoxTool("SkidCount");
Infragistics.Win.UltraWinToolbars.LabelTool skidToolLbl = new Infragistics.Win.UltraWinToolbars.LabelTool("SkidCountLabel");
skidToolLbl.SharedProps.Caption = "Skids: ";
skidToolLbl.SharedProps.AppearancesSmall.Appearance.TextHAlign = Infragistics.Win.HAlign.Right;
skidToolLbl.SharedProps.MinWidth = 50;
skidToolLbl.SharedProps.Width = 50;
skidToolLbl.SharedProps.MaxWidth = 50;
// Show 32 Skids
for (int i = 1; i < 33; i++)
{
comboSkidCountTool.ValueList.ValueListItems.Add( i );
}
comboSkidCountTool.SharedProps.MinWidth = 40;
comboSkidCountTool.SharedProps.Width = 40;
comboSkidCountTool.SharedProps.MaxWidth = 40;
comboSkidCountTool.SharedProps.AppearancesSmall.Appearance.TextHAlign = Infragistics.Win.HAlign.Left;
comboSkidCountTool.SharedProps.Caption = "Skids:";
comboSkidCountTool.SelectedIndex = 1;
comboSkidCountTool.DropDownStyle = Infragistics.Win.DropDownStyle.DropDownList;
//comboSkidCountTool.Value = "<Select a comnposer>";
comboSkidCountTool.SharedProps.ToolTipText = "How Many Skids Do You Need?";
comboSkidCountTool.AutoComplete = true;
comboSkidCountTool.SharedProps.AppearancesSmall.Appearance.Image = EpiUIImages.SmallEnabledImages.Images[EpiUIImages.IndexOf("Material")];
//
// Modify the Existing NewTool
//
baseToolbarsManager.Tools["NewTool"].SharedProps.Caption = "New Design";
//
// Create a Add Label Button
//
Infragistics.Win.UltraWinToolbars.ButtonTool NewLabelToolItem = new Infragistics.Win.UltraWinToolbars.ButtonTool("NewLabel");
NewLabelToolItem.SharedProps.Caption = "Add Label";
NewLabelToolItem.SharedProps.Enabled = true;
NewLabelToolItem.SharedProps.Visible = true;
NewLabelToolItem.SharedProps.AppearancesSmall.Appearance.Image = EpiUIImages.SmallEnabledImages.Images[EpiUIImages.IndexOf("Material")];
//
// Create a Print Button
//
Infragistics.Win.UltraWinToolbars.ButtonTool PrintToolItem = new Infragistics.Win.UltraWinToolbars.ButtonTool("PrintTool2");
PrintToolItem.SharedProps.Caption = "Print Labels";
PrintToolItem.SharedProps.Enabled = true;
PrintToolItem.SharedProps.Visible = false;
PrintToolItem.SharedProps.AppearancesSmall.Appearance.Image = EpiUIImages.SmallEnabledImages.Images[EpiUIImages.IndexOf("Print")];
// Register our Buttons with the Base Toolbars Manager
//baseToolbarsManager.Tools.Add(NewLabelToolItem);
baseToolbarsManager.Tools.Add(PrintToolItem);
baseToolbarsManager.Tools.Add(skidToolLbl);
baseToolbarsManager.Tools.Add(comboSkidCountTool);
// Add the NewLabel Button also to the Root Toolbar
//baseToolbarsManager.Toolbars["Standard Tools"].Tools.AddTool("NewLabel");
mainToolBar.Tools.AddTool("SkidCountLabel");
mainToolBar.Tools.AddTool("SkidCount");
// Add the Buttons to our Popup (DropDown) New Button Group
((Infragistics.Win.UltraWinToolbars.PopupMenuTool)baseToolbarsManager.Tools["NewMenuTool"]).Tools.AddTool("NewTool");
//((Infragistics.Win.UltraWinToolbars.PopupMenuTool)baseToolbarsManager.Tools["NewMenuTool"]).Tools.AddTool("NewLabel");
((Infragistics.Win.UltraWinToolbars.PopupMenuTool)baseToolbarsManager.Tools["NewMenuTool"]).Tools.AddTool("SkidCount");
}
For the dropdown you can use ToolValueChanged
private void UD08Form_ToolValueChanged(object sender, Infragistics.Win.UltraWinToolbars.ToolEventArgs args)
{
string sSkids = ((Infragistics.Win.UltraWinToolbars.ComboBoxTool)(args.Tool)).Text;
}
You can see the dropdown in this vid