Hi all.
I am creating a simple UserControl comprised of a label and a combo box. I want it to be data bound in the same way as a regular combo box, i.e. in design-time you can set the binding of the Text property.
However, I don't know how to do this, the only two options are "Advanced" and "Tag".
Thusly, my question: how can I expose, in design time, the databinding of the underlying ComboBox when that ComboBox is a constituent control of a UserControl?
I can always expose ComboBox's databinding as a property and do the binding in the code, but I would really like it to accessible through design time.
I am working on .net compact 2.0 under VS2005.
Any help appreciated.
Len La SalaPosted Feb 12, 2009, 6:15 PM
{
public UserControl1()
{
InitializeComponent();
}
private void UserControl1_Load(object sender, EventArgs e)
{
}
public ComboBox MyCombo //property of user control
{
get{return cb;} //the combo box you have placed on your user control, this gives you access to all properties of your combo box to do what you will.
}
}
}
On forms where you use the control you would access the combo box properties like
UserControl1.MyCombo.DataBindings.Add( ... );
www.c-sharplizards.com