0

저는 ASP-UserControl이 QuestionWithAnswer (.ascx) : BaseQuestion : UserControl 이고 ControlDesigner가 QuestionDesigner : UserControlDesigner입니다.Visual Studio는 CustomDesigner 대신 UserControlDesigner를 사용합니다.

[Designer(typeof(QuestionDesigner))] 
public class BaseQuestion : UserControl 

모든 유형이 동일한 어셈블리에있는 (웹 응용 프로그램) : 지금 내가 제어 및 디자이너를 연결합니다 DesignerAttribute를 사용합니다. 그러나 여전히 내 대신 UserControlDesigner가로드됩니다. 내 디자이너를 별도의 어셈블리에 넣어야 했습니까? asp 페이지 디자이너가 디자이너를 찾을 수 없다고 가정합니다.

xx! 개월


데모 코드 : http://msdn.microsoft.com/en-us/library/system.web.ui.design.usercontroldesigner.aspx :

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"); 
    } 
} 

답변

1

괜찮 이미 답이 있습니다.

은 당신의 자신의 디자이너가 UserControlDesigner에서 파생 만드는 에는 개발자 장점이 없습니다

비고. 사용자 지정 컨트롤 의 디자인 타임 환경을 향상 시키려면 컨트롤을 CompositeControl에서 가져오고 디자이너에서 CompositeControlDesigner 컨트롤을 파생시킵니다. 의 경우 ASP.NET 마크 업에 .ascx 파일 을 사용하지 마십시오.

제 경우에는 CompositeControls로 변경할 가능성이 없습니다. 나를 믿어, 내가 선호하는 복합/WebControls ...

관련 문제