UltraGrid 中的组合框

发布于 2024-07-23 08:21:35 字数 256 浏览 14 评论 0原文

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

我需要向现有 UltraGrid 控件添加一列。 这个新列必须像组合框一样,允许从值列表中进行选择。

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

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

I have to do some maintenance on an old VB.NET application (Visual Studio 2003) that uses Infragistics NetAdvantage 2006.

I need to add a column to an existing UltraGrid control. This new column must act like a ComboBox, allowing the selection from a list of values.

I added the new column, and set the Style to DropDownValidate. I created a ValueList and assigned it to the new column.

At run-time I don't get the expected results. What am I missing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

朮生 2024-07-30 08:21:35

像这样的东西应该适合你:

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;

Something like this should work for you:

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;
我还不会笑 2024-07-30 08:21:35

此代码对我有用:

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;

我通常将样式保留为默认值。

This code works for me:

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;

I generally leave the style as default.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文