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

dotnet windows forms designtime

group:

My own Collection in DesignTime and Delete Action


My own Collection in DesignTime and Delete Action Thibaud Bouquely
6/15/2005 8:24:40 PM
dotnet windows forms designtime:
Hello

I try to develop my own component with a collection property

Every thing work fine in Design Time except when I try delete the component,

Each sub component contains in collection property do not destroy and so,
InitializeComponent contains each sub component !! even if the main
component was destroyed !

NB :
My collection property have
DesignerSerializationVisibility(DesignerSerializationVisibility.Content)
attribut
and I try to develop a ComponentDesigner with override procedure
AssociatedComponent to give the SubComponent collection but it does not work
!

I certainly forget something somewhere, could you help me please ?

thanks for your help !

Re: My own Collection in DesignTime and Delete Action Phil Wright
6/15/2005 9:58:46 PM
You need to notify the design time environment that you have remove each of
the components inside the custom collection. So you need to ...

ITypeDescriptorContext context = (you get this context....)

// For each child component removed
context.Container.Remove(childComponent as IComponent);

// Then after all removed
context.OnComponentChanged()

Phil Wright
Follow my startup microISV at...
http://componentfactory.blogspot.com

[quoted text, click to view]

Re: My own Collection in DesignTime and Delete Action Thibaud Bouquely
6/15/2005 11:28:59 PM
thanks a lot for your help

I just find this article :
http://www.divil.co.uk/net/articles/designers/collectioncontrols.asp

where the author explain It necessary to use IComponentChangeService and
ComponentRemoved Event

your approch is different but i am not sure I understand

I already use ITypeDescriptorContext in Converter but the IDE give me an
instance of it, I never obtain it from something

(you get this context....) : How can I do this ? (with GetService method may
be on site of My component ???) and Where I must do this ? (in main
component in dispose method for example or in specific ComponentDesigner of
main component ?)



"Phil Wright" <phil.wright@dotnetmagic.com> a écrit dans le message de
news:%23o2bH0ecFHA.3032@TK2MSFTNGP10.phx.gbl...
[quoted text, click to view]

AddThis Social Bookmark Button