Infragistics填充下拉菜单 [英] Infragistics Populate DropDown menu

查看:135
本文介绍了Infragistics填充下拉菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将VS2013与Infragistics结合使用,是否可以通过编程方式填充 UltraDropDownButton 而不需要数据库?搜索有关如何执行此操作的文档无济于事,谷歌搜索也不会.列出的所有内容均建议使用.Items.Add();,尝试时不可用.我尝试过:

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:

我为图片表示歉意,但这更多是视觉问题,因为成员方法.Items不存在,与使用方法相同:

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.既没有Item的成员方法,也没有Add

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;

这是创建的表单的屏幕截图.只有1个按钮可见,因此您必须在此处进行一些工作以确保其满足您的要求.

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.

使用指南

关键信息来自《使用指南》的第二个要点.第二个链接中的示例使用树作为向按钮添加项目的示例.

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.

添加第二个控件,该控件将在下拉按钮为 点击.如果下拉菜单的界面将包含多个 WinForms控件,您将需要使用容器控件,例如 控制板. (您可能还希望将包含的控件添加到 容器,此时将构造 通过下拉菜单显示.)您还可以使用非容器控件 例如 ListView UltraWinGrid 作为下拉列表.

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.

这篇关于Infragistics填充下拉菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆