Infragistics Ultragrid - 组合框作为列
我对 Infragistics 的 UltraGrid 控件有疑问。我创建了一个包含一些值的 ultracombobox:
UltraCombo ultraComboPaneel = new UltraCombo();
ultraComboPaneel.DataSource = articleList;
ultraComboPaneel.ValueMember = "ArticleID";
ultraComboPaneel.DisplayMember = "Name";
现在我有一个 UltraGrid,我想将 ultraCombo 放入一个单元格中,这样我就可以选择 ultracombo 的一项作为单元格值。我在代码和超网格设计器中都尝试过,但我似乎找不到办法。
你们有什么想法吗?如果需要,可以提供更多信息
编辑:
我发现一些东西,就像
UltraGridColumn ugc = ultraGridTypePaneel.DisplayLayout.Bands[0].Columns.Add("combo");
ultraGridTypePaneel.DisplayLayout.Bands[0].Columns["combo"].EditorControl = ultraComboPaneel;
我觉得我走在正确的路上,但它仍然没有显示在屏幕上......
I have a problem with the UltraGrid control from Infragistics. I have created a ultracombobox with a few values in it:
UltraCombo ultraComboPaneel = new UltraCombo();
ultraComboPaneel.DataSource = articleList;
ultraComboPaneel.ValueMember = "ArticleID";
ultraComboPaneel.DisplayMember = "Name";
Now I have an UltraGrid, and I want to put the ultraCombo in a cell so I can choose one of the items of the ultracombo as a cell value. I tried it both in code and in the ultragrid designer but i can't seem to find a way to do it.
Any of you got an idea? More information can be provided if needed
Edit:
I found something like
UltraGridColumn ugc = ultraGridTypePaneel.DisplayLayout.Bands[0].Columns.Add("combo");
ultraGridTypePaneel.DisplayLayout.Bands[0].Columns["combo"].EditorControl = ultraComboPaneel;
I feel I'm on the right way but it is still not showing on the screen...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
UltraCombo 提供了大量的功能。如果您需要的只是能够从列表中选择一个项目,您可能会发现网格的 ValueLists 提供了更好的解决方案。
下面是一些可以帮助您入门的代码:
The UltraCombo provides a great deal of functionality. If all you need is the ability to choose an item from a list, you might find the grid's ValueLists provide a better solution.
Here's some code to get you started:
您可以在下面的链接中找到一些可用于将 DropDown 放入 UltraGrid 单元格中的方法:
http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=7841
返回到您当前的代码片段 - 你就快到了:
首先,你应该将 UltraCombo 的绑定上下文设置为 UltraCombo 将使用的形式的 BindingContext,如下所示:
ultraComboPaneel.BindingContext = this.BindingContext;
请注意,应在将控件设置为 EditorControl 之前设置绑定上下文。我注意到的另一件事是,该属性当前已更改为 EditorComponent,因此我相信您正在使用旧版本的 Infragistics 组件。但是,您仍然应该能够使用相同的方法。我创建了一个小代码片段,用代码显示了上述内容:
希望这会有所帮助。
You could find at the link below some approaches that you could use to put a DropDown into a UltraGrid cell:
http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=7841
Going back to your current code snippet - you are almost there:
First you should set the binding context of your UltraCombo to the BindingContext of the form the your UltraCombo will be used like:
ultraComboPaneel.BindingContext = this.BindingContext;
Please note that setting binging context should happen prior setting your control to be EditorControl. One more thing that I noticed is that the property currently is changed to EditorComponent so I believe that you are using older version of the Infragistics components. However you should still be able to use the very same approach. I have created small code snippet showing the above with code:
Hope this helps.
我改用 Ultra Dropdown。
dim udd As UltraDropDown
udd = New UltraDropDown
关键是将ultra网格列的“值列表”分配给Drop down控件的最后一行。
I use the Ultra Dropdown instead.
dim udd As UltraDropDown
udd = New UltraDropDown
The key is the last line that assigns the "Value List" of the ultra grid column to the Drop down control.