我必须做对使用的Infragistics的NetAdvantage 2006旧VB.NET应用(Visual Studio 2003中)一些维护

我需要的列添加到现有的UltraGrid控制。这种新的柱必须像一个ComboBox,允许从值的列表的选择。

我添加新的列,和样式设置为DropDownValidate。我创建了一个值列表,并将其分配给新列。

在运行时我没有得到预期的结果。我缺少什么?

有帮助吗?

解决方案

这样的事情应该为你工作:

var dataTable = new DataTable( "Table1" );
dataTable.Columns.Add( "Column1" );
dataTable.Rows.Add( dataTable.NewRow() );

ultraGrid1.DataSource = dataTable;

var valueList = new ValueList();
valueList.ValueListItems.Add( "dataValue1" , "displayText1" );
valueList.ValueListItems.Add( "dataValue2" , "displayText2" );
valueList.ValueListItems.Add( "dataValue3" , "displayText3" );

ultraGrid1.DisplayLayout.Bands[0].Columns[0].ValueList = valueList;

// Setting the ColumnStyle to DropDownList ensures that the user will not 
// be able to type in the cell (exclude this line if you want to allow typing)
ultraGrid1.DisplayLayout.Bands[0].Columns[0].Style = ColumnStyle.DropDownList;
// Setting the ButtonDisplayStyle to Always ensures that the UltraGridColumn 
// always displays as a ComboBox and not just when the mouse hovers over it
ultraGrid1.DisplayLayout.Bands[0].Columns[0].ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always;

其他提示

此代码为我工作:

ultraGridValueList.ValueListItems.Add( “ValueMemeber1”, “DisplayMemeber1”); ultraGridValueList.ValueListItems.Add( “ValueMemeber2”, “DisplayMemeber2”); ultraGridValueList.ValueListItems.Add( “ValueMemeber3”, “DisplayMemeber3”); ultraGridValueList.ValueListItems.Add( “ValueMemeber4”, “DisplayMemeber4”);

ultraGrid1.DisplayLayout.Bands [0] .Columns [ “myDropDownCol”]值列表= ultraGridValueList;

我一般离开的样式为默认值。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top