Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Smart tags not show for custom control designer
 

Smart tags not show for custom control designer

I am struggling with Smart Tag support for a custom designer I have developed. Here are the relevant details:

* I am hosting my own DesignSurface (MyDesignSurface)
* I am using VS2008 SP1 on Windows XP w/ .NET 3.5 SP1
* The designer, MyDesigner, inherits from DocumentDesigner
* The control I am designing, MyControl, is the root control for the surface and inherits from Panel.

When MyDesigner is created, the ActionLists property is never accessed and my smart tags do not show up. I am able to force them to display through the DesignerActionService, but it's not a pretty solution.

There are some wrinkles in my design. First, the control I am designing does NOT have a Designer attribute on it. Instead, I use the DesignSurface to create the right designer in the "CreateDesigner" method:

public class MyDesignSurface : DesignSurface {
...
protected override IDesigner CreateDesigner(IComponent component, bool rootDesigner) {
if (component is MyControl && rootDesigner)
return new MyDesigner();
else ...
}
...
}

The "CreateInstance" method on MyDesignSurface is also a little special. "MyControl" is returned when ANOTHER type is going to be designed. Essentially, "MyControl" stands in as a proxy:

protected override object CreateInstance(Type type) {
...
if (type == typeof(MyRealComponent))
{
return new MyControl();
}
}

In case it's relevant, "MyRealComponent" above inherits from Component. In MyDesigner, the override for ActionLists looks like:

public class MyDesigner : DocumentDesigner {
...
DesignerActionListCollection _actions;

public override DesignerActionListCollection ActionLists {
get {
if (_actions == null) {
_actions = new DesignerActionListCollection();
_actions.Add(new MyActionList((MyControl) this.Control));
}

return _actions;
}
}
}


Where MyActionList is implemented in the obvious way.

Finally, because MyControl inherits from Panel, it has some attributes and properties I don't want. I override PreFilterAttributes and PreFilterProperties in MyDesigner to remove those.

Can anyone give a hint why my smart tag actions do not show up? Through trace messages I have confirmed the ActionLists property is never accessed.

I'm glad to provide more information as needed! Thanks in advance.

Justin Bailey  Thursday, March 12, 2009 3:28 PM
If anyone has an idea what might be going on here, I'd love to hear it. What can I add to help you answer the question? More code? Is the problem just too obscure? I'm glad to give more info!

Justin
Justin Bailey  Friday, March 13, 2009 3:32 PM

You can use google to search for other answers

Custom Search

More Threads

• Longhorn style Breadcrumb Bar
• In Visual Basic .Net 2003 - capturing key press events in a ListBox.
• cloning a listview
• Hidden Fields
• view designer error - there is no editor available for c:\tmp\windowsapplication1\form1.vb file
• Extending the ContextMenu Class
• TreeView Double Click and canceling expansion
• Customizing DesignSurface to allow resizing of UserControl child controls
• Need a push in the right direction - Floating Box?
• how to draw a line on the form?