I have the need to add a more advanced combobox to the QuickAccessToolbar so that from anywhere within the application a person can access the details contained within the combobox (4 columns).
I have created this block of code to accomplish the task:
//create the control container and assign it to the menu control. ControlContainerTool cboTool = new ControlContainerTool("cboCust"); utmMain.Tools.Add(cboTool); utmMain.Ribbon.QuickAccessToolbar.Tools.AddTool("cboCust"); //Create the control to assign to the control container. UltraCombo cboCust = new UltraCombo(); cboCust.Width = 250; cboCust.Visible = false; this.Controls.Add(cboCust); //Add the control to the control container. cboTool.Control = cboCust; cboTool.SharedProps.AllowMultipleInstances = false;
As you can see my intent is to add a control container to the UltraToolBarsManager then add that tool to the QuickAccessToolbar. However when adding the ControlContainer to the QuickAccessToolbar I receive this exception:
The tool being added is not allowed in this tools collection.
How can I accomplish the desired outcome?
Thank you,
Duane
Hi Duane,
In order to get this working, you will need to set AllowMultipleInstance to true. Tools are not allowed on the QAT if this property is false. Additionally, you will need to move the call to AddTool to after modifying these settings, so that they have the correct values when the ToolbarsManager evaluates whether it can be added to the QAT. Finally, you will need to set IsGlassSupported on the UltraToolbarsManager to false to allow the combo box to render properly.
I recommend using a ComboBoxTool instead of ControlContainerEditor. Please try out this code:
ComboBoxTool cboTool = new ComboBoxTool("cboCust");ultraToolbarsManager1.Tools.Add(cboTool);cboTool.DropDownStyle = Infragistics.Win.DropDownStyle.DropDown;cboTool.SharedProps.AllowMultipleInstances = true;ultraToolbarsManager1.Ribbon.QuickAccessToolbar.Tools.AddTool("cboCust");ultraToolbarsManager1.IsGlassSupported = false;
Note that I set the DropDownStyle property on the ComboBoxTool to allow typing in the edit portion.
Please let me know if this works for you.
The ComboBoxTool is the intrinsic UltraToolbarsManager control which will only display a single value. I have that working through the designer, however that control is simply not rich enough for my needs, hence the need to add a UltraCombobox which can contain more than one column.
Is there no way to use a more functional control on the QuickAccessToolbar?
Thanks,