Custom user control - generate code

  • Thread starter Thread starter Lut
  • Start date Start date
L

Lut

Hey,

I made a custom usercontrol (Custom listview) in the
Control Library.

Now I want in the properties of design a property 'Sort'.
(That is not a problem to do that) But, when it is Yes
then I want to add following code in my class.

private ListViewSortManager SortMgr1;

and in the InitialiseComponent
this.SortMgr1 = new ListViewSortManager(......);

How can I generate this code when I choose in the design
time sort = yes

Thanks,
Lut
 
Lut,

I think that what you will have to do is create a custom designer for
the Sort property. When the sort property is set to true, you would then
also set the SortMgr1 property to an instance of the class that you create.
However, I don't think you will be able to use the constructor like that.
If anything, you will have to create a new instance of the class (default
instance), and then set the properties on the instance (kind of like a
collection editor works).

Hope this helps.
 
Back
Top