Infragistics Populate DropDown menu

送分小仙女□ 提交于 2019-12-13 02:01:02

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/25416859/infragistics-populate-dropdown-menu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!