怎样实现控件的自定义属性可以向标准的.NET控件一样,直接在属性窗口中绑定数据.
比如TextBox控件,在属性设计器中,“数据\DataBindings\Text”,该属性可以利用设计器中提供的下列选择框进行选择DataSet中DataTable的具体成员,例如选择某数据库表的某字段。
自定义控件的自定义属性怎样实现?
使用如下方式只能选择某DataSet,而不能选择其中的某类的成员.
private object bindDataSource;
[AttributeProvider(typeof(System.ComponentModel.IListSource))]
public object BindDataSource
{
get
{
return bindDataSource;
}
set
{
bindDataSource = value;
}
}