|
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.
|