ggp*_*nti 1 vb.net infragistics ultrawingrid
我必须对使用Infragistics NetAdvantage 2006的旧VB.NET应用程序(Visual Studio 2003)进行一些维护.
我需要在现有的UltraGrid控件中添加一列.此新列必须像ComboBox一样,允许从值列表中进行选择.
我添加了新列,并将Style设置为DropDownValidate.我创建了一个ValueList并将其分配给新列.
在运行时我没有得到预期的结果.我错过了什么?
这样的事情对你有用:
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;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6704 次 |
| 最近记录: |