ASP-UserControlQuestionWithAnswer (.ascx) : BaseQuestion : UserControl
と ControlDesignerがありQuestionDesigner : UserControlDesigner
ます。次に、DesignerAttribute を使用してコントロールとデザイナーを関連付けます。
[Designer(typeof(QuestionDesigner))]
public class BaseQuestion : UserControl
すべてのタイプが同じアセンブリ (WEB アプリケーション) にあります。しかし、それは私の代わりに UserControlDesigner をロードします。デザイナーを別のアセンブリに配置する必要がありましたか? asp-page デザイナーがデザイナーを見つけられないと思います。
どうも!モ
デモコード:
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");
}
}