【发布时间】:2010-02-26 13:22:00
【问题描述】:
我有一个 ASP-UserControl QuestionWithAnswer (.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");
}
}
【问题讨论】:
标签: c# .net asp.net visual-studio-2008 custom-server-controls