我有一个 ASP-UserControlQuestionWithAnswer (.ascx) : BaseQuestion : UserControl
和一个 ControlDesigner QuestionDesigner : UserControlDesigner
。现在我使用 DesignerAttribute 来关联控件和设计器:
[Designer(typeof(QuestionDesigner))]
public class BaseQuestion : UserControl
所有类型都在同一个程序集中(WEB 应用程序)。但它仍然加载 UserControlDesigner 而不是我的。我必须把我的设计师放在一个单独的组件中吗?我想asp页面设计器找不到设计器。
谢谢!莫
演示代码:
public class FragenDesigner : UserControlDesigner
{
private DesignerActionList _actionList;
private DesignerVerb[] _verbs;
public override DesignerActionListCollection ActionLists
{
get
{
if (_actionList == null)
{
_actionList = new DesignerActionList(new System.Windows.Forms.TextBox());
_actionList.AutoShow = true;
ActionLists.Add(_actionList);
}
return base.ActionLists;
}
}
public override DesignerVerbCollection Verbs
{
get
{
if (_verbs == null)
{
_verbs = new DesignerVerb[]
{
new DesignerVerb("test", onblabla),
};
Verbs.AddRange(_verbs);
}
return base.Verbs;
}
}
private void onblabla(object sender, EventArgs e)
{
MessageBox.Show("blabla");
}
}