all groups > dotnet windows forms designtime > august 2005 >
You're in the

dotnet windows forms designtime

group:

Generating properties using a Custom ComponentDesigner


Generating properties using a Custom ComponentDesigner Frank NO[at]SPAM etc.be
8/17/2005 1:13:28 PM
dotnet windows forms designtime: Hi,


I have the following situation.

I've create a baseclass, derived it from Component and created a
custom designer for it. The desinger is more or less a grid in wich you
can add/edit some properties and attributes for them.

My goal is that when the designer is saved, all properties are
automaticly generated in the component is was designing.

I've noticed that you can implement your own CodeDomSerializer on a
component, but this only serializes the components public properties in
the 'InitializeComponent' method of its container.

I don't have a container, I would like to (re)generate to code of the
component I'm designing

I hope this makes sence, but is there someone who can tell me how I can
handle the complete (de)serialization of a component using its custom
designer.

Kind Regards
Frank Vanderlinden
Re: Generating properties using a Custom ComponentDesigner Frank NO[at]SPAM etc.be
8/17/2005 11:46:39 PM
Maybe a little example to clarify.

Normally when you drop components on a designer, the following code is
generated

class TestItem : DesignableItem {
private DesignableProperty designableProperty1;

private void InitializeComponent() {
this.designableProperty1 = new Dmx.Designers.DesignableProperty();
// This comment was added to this object by a custom serializer.
//
// designableProperty1
//
this.designableProperty1.Name = "Test";

}
}

I would like to change to (de)serialization of the componente so I get
the following result.

class TestItem : DesignableItem {
private DesignableProperty designableProperty1;

private void InitializeComponent() {
this.designableProperty1 = new Dmx.Designers.DesignableProperty();
this.designableProperty1.Name = "Test";
}

public string Test {
get { return this.designableProperty1.Text; }
set { this.designableProperty1.Text = value; }
}
}


How can I automaticly generate the "Test" property ?

Kind regards
Frank Vanderlinden
AddThis Social Bookmark Button