Quick question about inheriting designers....
If I create a custom designer for a base control but not for controls that inherit from it then the child controls will also inherit the base control's designer, correct
But users may want to drop a control of both types onto the same form. My issue is that when I retrieve a designer for a control like this...
IDesigner dsgnr = (IDesigner)dh.GetDesigner((Control)ss.PrimarySelection );...it appears they will share instances of the designer. In other words, two of the same Designer Verb links appear in the property window. Do I have to create designer classes for all my sub controls to get around this

Inheriting Designer
Al C.
* I have a 3rdParty control which uses 3rdPartyDesigner.
* I derived MyBaseControl from the 3rdPartyControl and MyBaseControlDesigner from 3rdPartyDesigner and I added a DesignerVerb of my own.
* Then I created MyDerivedControl from MyBaseControl without configuring a designer (so it inherit's it's bases designer).
* When I put two instances of MyDerivedControl on the form, the property window shows two links for the same DesignerVerb (n instances = n links)
In MyBaseControlDesigner I'm adding verbs in the selection changed event:
public void OnSelectionChanged(object sender, EventArgs e)
{
ISelectionService ss = (ISelectionService)GetService(typeof(ISelectionService));
if (ss != null)
{
if( ss.PrimarySelection is MyBaseControl || ss.PrimarySelection is MyDerivedControl )
{
MessageBox.Show("Handling OnSelectionChanged BEGINS NOW");
IDesignerHost dh = (IDesignerHost)this.GetService(typeof(IDesignerHost));
IDesigner dsgnr = (IDesigner)dh.GetDesigner((Control)ss.PrimarySelection );
if ( !dsgnr.Verbs.Contains(SomeVerb) )
{
foreach(DesignerVerb vrb in dsgnr.Verbs)
MessageBox.Show(String.Format("[{0}]==[{1}] ",vrb.ToString(),SomeVerb.ToString()));
dsgnr.Verbs.Add(SomeVerb);
}
}
}
}
GavH
The event fired once for every instance of the control (with different SomeVerbs) but GetDesigner always returned the designer for the SelectedControl. To fix it I made SomeVerb public and then changed the code to use the SomeVerb from the dsgn instance...
if ( !dsgnr.Verbs.Contains(((MyBaseControlDesigner)dsgnr).SomeVerb) )
{
:
...argh! wasted too much time on that one!