简体   繁体   中英

Infragistics Populate DropDown menu

Using VS2013 with Infragistics, is it possible to programmatically populate the UltraDropDownButton without the need of a database? Searching the documentation on how to do this returns no avail, nor does a google search. Everything listed suggests using .Items.Add(); Which is not available when trying. I have tried:

找不到会员。

I apologize for the picture, but it's a more of a visual problem as the member method .Items does not exist, the same with using:

SearchParams. There is no member method for Items nor Add

I think that it is possible, but you may have to do some work to get it to appear correctly.

Here is some sample code that I threw together real quick

    Panel panel = new Panel();
    panel.Controls.Add(new Button() { Text = "Button 1" });
    panel.Controls.Add(new Button() { Text = "Button 2" });

    UltraPopupControlContainer container = new UltraPopupControlContainer();
    container.PopupControl = panel;

    ultraDropDownButton1.PopupItem = container;

Here is a screenshot of the created form. Only 1 button is visible, so that's where you'll have to do some work to make sure it meets your requirements.

示例表格

I found all the info necessary to throw that together on the infragistics site.

UltraDropDownButton Docs

UltraPopupControlContainer Docs

Usage Guide

The key information is from the second bullet point from the Usage guide. The example in the second link uses a tree as an example of adding an item to the button.

Add a second control that will displayed when the drop-down button is clicked. If the interface of the drop-down will consist of multiple WinForms controls, you will want to use a container control such as a Panel. (You may also want to add the contained controls to the container at this point, constructing the interface that will be displayed by the drop-down.) You can also use a non-container control such as a ListView or an UltraWinGrid as the drop-down.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM