我有一個ASP用戶控件QuestionWithAnswer (.ascx) : BaseQuestion : UserControl
和ControlDesigner QuestionDesigner : UserControlDesigner
。 現在我用的DesignerAttribute來控制和名牌關聯:Visual Studio使用UserControlDesigner而不是CustomDesigner
[Designer(typeof(QuestionDesigner))]
public class BaseQuestion : UserControl
所有類型都在同一組件(WEB應用)。 但它仍然加載UserControlDesigner而不是我的。 我必須把我的設計師放在單獨的裝配中嗎? 我想asp頁面設計者找不到設計師。
thx! 月
演示代碼:
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");
}
}