【问题标题】:Multicolumn Dropdown in UltragridUltragrid 中的多列下拉菜单
【发布时间】:2013-05-23 09:38:10
【问题描述】:

我必须对使用 Infragistics 的 VB.NET 应用程序 (Visual Studio 2012) 进行一些维护。

我需要修改现有UltraGrid 控件中的列。其中一列已经是dropdown,现在应该将其更改为Multicolumn 下拉列表,允许从值列表中进行选择。

我修改了列,现在我正在考虑要在样式中设置什么?。我创建了一个ValueList 并将其分配给新列。

如何做到这一点?

注意:我尝试将类型设置为 dropdown 并绑定 valuelist,但它仅显示结果中检索到的 dropdown 中的第一个 column

【问题讨论】:

标签: .net vb.net infragistics ultrawingrid


【解决方案1】:

基本上你需要使用 UltraCombo,而不是 ValueList。这是一个关于如何做到这一点的示例,但缺少许多细节,例如如何从您需要提供的数据表中检索值

private Sub grid_InitializeLayout(object sender, InitializeLayoutEventArgs e) Handles InitializeLayout
    Dim yourTable As DataTable = GetYourDataTable()
    Dim combo = new UltraCombo()
    combo.DataSource = yourTable
    combo.DisplayMember = "Field_name_To_Display"
    combo.ValueMember = "Field_name_that_binds_combo_table_To_grid_Column"
    ' Now supposing the column that needs the combo is the first one of your grid
    e.Layout.Bands(0).Columns(0).ValueList = combo
End Sub

【讨论】:

  • 我应该使用什么样式类型来设置列?
  • 这取决于您是否希望组合可编辑或只是一个选择列表(Dropdown、DropdownWithList 等)...。更新答案以显示 DisplayMember 和 ValueMember 属性也应设置为正确绑定带有查找列的 Combo 数据表
  • @Sandy 如果您在考虑使用实现 IValueList 的 UltraDropDown 之前使用 ValueList,您可以将 UltraDropDown 的实例设置为列的 ValueList 属性,就像您已经在使用 ValueList 一样.
  • @Steve:当我尝试将它绑定到 ultracombo 的数据源时,它会抛出“对象引用未设置为对象的实例。”
  • @Steve:我正在绑定一个将 2 行返回到 ultracombo 的集合。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-07-05
  • 1970-01-01
  • 2015-03-15
相关资源
最近更新 更多