Pregunta

Tengo que hacer algo de mantenimiento en una aplicación VB.NET edad (Visual Studio 2003) que utiliza Infragistics NetAdvantage 2006.

Tengo que añadir una columna a un control UltraGrid existente. Esta nueva columna debe actuar como un cuadro combinado, que permite la selección de una lista de valores.

He añadido la nueva columna, y para cambiar el estilo de DropDownValidate. He creado un ValueList y le asignó a la nueva columna.

En tiempo de ejecución que no tenga los resultados esperados. ¿Qué me falta?

¿Fue útil?

Solución

Algo como esto debería funcionar para usted:

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;

Otros consejos

Este código funciona para mí:

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"] ValueList = ultraGridValueList;.

Yo generalmente dejo el estilo por defecto.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top