R
roger
Hi, i have a serious problem with designtime serialization
in one of my windows forms controls
the control exposes a collection of "Bands"
MyControl
{
public BandCollection Bands{ get ...}
}
what i want to do is to make my "band" objects persist to
the forms designer initialize code in the following way:
private void InitializeComponent()
{
.......
MyControl1.Bands.AddRange(new Band[] {
new Band(123,"abc",1.23,this.TextBox1),
new Band(888,"hhh",567,this.TextBox2),
new Band(123,"iii",888,null),
});
.....
}
whad do i need in order to do this?
i have tried the following ways:
1) implement ISerializable on the band , and add a
expandableobject converter ... this failed since some of
the parameters needed to create an instance wasnt
serializable
2) making the band inherit from component... this worked
fine , but added zillions of components to the form , i
dont want this..
3) just using a expandable object converter , this also
fails , it doesnt seem like it can persist references to
other designer memebrs such as "this.textbox1" (it was
always replaced with null)
so what do i need??
CodeDom serialization??
samples would also be very nice
//Roger
in one of my windows forms controls
the control exposes a collection of "Bands"
MyControl
{
public BandCollection Bands{ get ...}
}
what i want to do is to make my "band" objects persist to
the forms designer initialize code in the following way:
private void InitializeComponent()
{
.......
MyControl1.Bands.AddRange(new Band[] {
new Band(123,"abc",1.23,this.TextBox1),
new Band(888,"hhh",567,this.TextBox2),
new Band(123,"iii",888,null),
});
.....
}
whad do i need in order to do this?
i have tried the following ways:
1) implement ISerializable on the band , and add a
expandableobject converter ... this failed since some of
the parameters needed to create an instance wasnt
serializable
2) making the band inherit from component... this worked
fine , but added zillions of components to the form , i
dont want this..
3) just using a expandable object converter , this also
fails , it doesnt seem like it can persist references to
other designer memebrs such as "this.textbox1" (it was
always replaced with null)
so what do i need??
CodeDom serialization??
samples would also be very nice

//Roger