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
70
QuickAccessToolbar
posted

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

Parents
No Data
Reply
  • 12480
    Offline posted

    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. 

     

Children