语言

IDynamicValues 接口

定义

IDynamicValues 接口用于为字符串属性创建动态列表。 类应实现此接口,并使用 DynamicValuesAttribute(下面的)启用动态值的生成。

当在运行时应显示在下拉列表中之前未知的字符串列表时,可以使用此交互和属性。 其中的良好示例包括数据库名称、用户、排序规则等。

public interface IDynamicValues
type IDynamicValues = interface
Public Interface IDynamicValues

示例

public TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { string[] collationName = new string[] { “first item”, “second itme” }; return new TypeConverter.StandardValuesCollection(collationName); }

方法

名称 说明
GetStandardValues(ITypeDescriptorContext)

GetStandardValues 应返回 StandardValuesCollection,其中包含要在上下文中属性说明符列表中显示的所有项。

适用于