Hello
I'm trying to create a user control for myself that has two ListBoxes
in it. The two ListBoxes will be databound to BindingSources on the
parent form. I've got the DataSource properties exposed, and added
designer support in VS2005 using the [AttributeProvider (typeof
(IListSource))] tag, but how do I expose the DisplayMember &
ValueMember properties in a similar manner, so that I can select them
from a drop down list, rather than having to type the names into the
properties window myself?
My current code (not including the *.designer.cs code):
public MyNamespace {
public partial class MyUserControl {
[AttributeProvider (typeof(IListSource))]
public object ListBox1DataSource {
get { return this.listbox1.DataSource; }
set { this.listbox1.DataSource = value; }
}
[AttributeProvider (typeof(IListSource))]
public object ListBox2DataSource {
get { return this.listbox2.DataSource; }
set { this.listbox2.DataSource = value; }
}
public string ListBox1DisplayMember {
get { return this.listbox1.DisplayMember; }
set { this.listbox1.DisplayMember = value; }
}
public string ListBox1ValueMember {
get { return this.listbox1.ValueMember; }
set { this.listbox1.ValueMember = value; }
}
public string ListBox2DisplayMember {
get { return this.listbox2.DisplayMember; }
set { this.listbox2.DisplayMember = value; }
}
public string ListBox2ValueMember {
get { return this.listbox2.ValueMember; }
set { this.listbox2.ValueMember = value; }
}
}
}
Thanks,
Evan
|