how to use DataMemberListEditor in the control's smart tag

A

Aloneplayer

Hi, everyone,
I'm a developer using Whidbey bate 2 CTP December 2004.

I wrote a control can do complex databinding,which has properties
named "DataSource" and "DataMember", I add a smart tag for my control
to config the databinding at design time:

internal class MyControlDesigner : ControlDesigner
{

....
....
[ComplexBindingProperties("DataSource", "DataMember")]
private class MyControlChooseDataSourceActionList :
DesignerActionList
{
// Fields
private MyControlDesigner _owner;
// Methods
public MyControlChooseDataSourceActionList(MyControlDesigner
owner)
: base(owner.Component)
{
_owner = owner;
}
public override DesignerActionItemCollection
GetSortedActionItems()
{
DesignerActionItemCollection collection1 = new
DesignerActionItemCollection();

DesignerActionPropertyItem item1 = new
DesignerActionPropertyItem("SetDataSource", "DataSource:");
collection1.Add(item1);
DesignerActionPropertyItem item2 = new
DesignerActionPropertyItem("SetDataMember", "DataMember:");
collection1.Add(item2);
return collection1;
}


[AttributeProvider(typeof(IListSource))]
public object SetDataSource
{
get
{
return ((MyControl)this._owner.Component).DataSource;
}
set
{
MyControl control = (MyControl )this._owner.Component;
sheet.DataSource = value;

}
}

[Editor("System.Windows.Forms.Design.DataMemberListEditor",
typeof(System.Drawing.Design.UITypeEditor))]
public string SetDataMember
{
get
{
return ((MyControl )this._owner.Component).DataMember;
}
set
{
MyControl myControl= (MyControl )this._owner.Component;

myControl.DataMember = value;


}
}
}

}
}
But when I open the smart tag at design time, I just can use the
DataSourceEditor in the smart tag,
The DataMemberListEditor can't be used here .

if I add
[Editor("System.Windows.Forms.Design.DataMemberListEditor",
typeof(System.Drawing.Design.UITypeEditor))]
to MyControl.DataMember, I can use DataMemberListEditor in the PropertyGrid.

Could you tell me how to use DataMemberListEditor in the control's smart
tag?
Thank you!
 
Top