I want to add a DataSource property to my control that, at design time, will allow the designer to drop down a list of valid datasource components just like the DataGrid control. The type on the DataSource property is just 'object', so I know it isn't that. Is there a special designer attribute I have to use on my property

Actually my Control has a Combobox and i just want to enable the combobox's (DataSource, DisplayMember, ValueMember) properties

If I map the properties 1to1 like this

[Category("Data"), DefaultValue(null), Description("The datasource that is used to populate the list with items.")
public object DataSourc

get{return this.comboBox.DataSource;
set{this.comboBox.DataSource = value;


[DefaultValue(""), Description("Gets or sets the column for display."), Category("Data")
public string DisplayMembe

get{return this.comboBox.DisplayMember;
set{this.comboBox.DisplayMember = value;


[DefaultValue(""), Description("Gets or sets the column for value."), Category("Data")
public string ValueMembe

get{return this.comboBox.ValueMember;
set{this.comboBox.ValueMember = value;


It breakes the Designers ability to show a dropdown list of avaiable DataSource's.

Re: DataSource property to control design time by Claes

Claes
Tue Jun 01 03:24:40 CDT 2004

All the DataSource properties (DataGrid, ComboBox etc)
seems to be using a TypeConverterAttribute set to
System.Windows.Forms.Design.DataSourceConverter
Try adding this:

TypeConverter("System.Windows.Forms.Design.DataSourceConverter,
System.Design")

/claes

"Morten Lyhr" <anonymous@discussions.microsoft.com> wrote in message
news:67DBE1E2-DCD9-4C9C-8402-8E2AD0CD1B7A@microsoft.com...
> I want to add a DataSource property to my control that, at design time,
will allow the designer to drop down a list of valid datasource components
just like the DataGrid control. The type on the DataSource property is just
'object', so I know it isn't that. Is there a special designer attribute I
have to use on my property?
>
> Actually my Control has a Combobox and i just want to enable the
combobox's (DataSource, DisplayMember, ValueMember) properties.
>
> If I map the properties 1to1 like this:
>
>
> [Category("Data"), DefaultValue(null), Description("The datasource that is
used to populate the list with items.")]
> public object DataSource
> {
> get{return this.comboBox.DataSource;}
> set{this.comboBox.DataSource = value;}
> }
>
> [DefaultValue(""), Description("Gets or sets the column for display."),
Category("Data")]
> public string DisplayMember
> {
> get{return this.comboBox.DisplayMember;}
> set{this.comboBox.DisplayMember = value;}
> }
>
> [DefaultValue(""), Description("Gets or sets the column for value."),
Category("Data")]
> public string ValueMember
> {
> get{return this.comboBox.ValueMember;}
> set{this.comboBox.ValueMember = value;}
> }
>
> It breakes the Designers ability to show a dropdown list of avaiable
DataSource's.