public class CustomComboBox : UserControl
{
[Category("Data")]
public ComboBox.ObjectCollection Items
{
get { return this.comboBox1.Items; }
}
public object SelectedItem
{
get { return this.comboBox1.SelectedItem; }
set { this.comboBox1.SelectedItem = value; }
}
public override String Text
{
get { return this.comboBox1.Text; }
set { this.comboBox1.Text = value; }
}
//[Category("Data")]
//public new ControlBindingsCollection DataBindings
//{
// get { return this.comboBox1.DataBindings; }
//}
//[Category("Data")]
//public object DataSource
//{
// get { return this.comboBox1.DataSource; }
// set { this.comboBox1.DataSource = value; }
//}
//private BindingContext bindingContext;
//public override BindingContext BindingContext
//{
// set
// {
// bindingContext = value;
// OnBindingContextChanged(EventArgs.Empty);
// }
// get
// {
// // check if a BindingContext has been assigned
// if (bindingContext != null)
// return bindingContext;
// // check if we have a parent
// if (Parent != null)
// return Parent.BindingContext;
// // otherwise return null
// return null;
// }
//}
//protected override void OnParentBindingContextChanged(EventArgs e)
//{
// if (bindingContext == null)
// OnBindingContextChanged(EventArgs.Empty);
//}
//[Category("Data")]
//public String DisplayMember
//{
// get { return this.comboBox1.DisplayMember; }
// set { this.comboBox1.DisplayMember = value; }
//}
public event EventHandler SelectedValueChanged
{
add
{ this.comboBox1.SelectedValueChanged += value; }
remove
{ this.comboBox1.SelectedValueChanged -= value; }
}
public object DataSource
{
get { return comboBox1.DataSource; }
set { comboBox1.DataSource = value; }
}
public string DisplayMember
{
get { return comboBox1.DisplayMember; }
set { comboBox1.DisplayMember = value; }
}
public string ValueMember
{
get { return comboBox1.ValueMember; }
set { comboBox1.ValueMember = value; }
}
}
|