ControlDesigner.SetEditableDesignerRegionContent 메서드

정의

디자인 타임에 컨트롤의 편집 가능한 영역에 대한 내용을 지정합니다.

public:
 virtual void SetEditableDesignerRegionContent(System::Web::UI::Design::EditableDesignerRegion ^ region, System::String ^ content);
public virtual void SetEditableDesignerRegionContent (System.Web.UI.Design.EditableDesignerRegion region, string content);
abstract member SetEditableDesignerRegionContent : System.Web.UI.Design.EditableDesignerRegion * string -> unit
override this.SetEditableDesignerRegionContent : System.Web.UI.Design.EditableDesignerRegion * string -> unit
Public Overridable Sub SetEditableDesignerRegionContent (region As EditableDesignerRegion, content As String)

매개 변수

region
EditableDesignerRegion

컨트롤 내의 편집 가능한 디자인 영역입니다.

content
String

편집 가능한 디자인 영역에 할당할 내용입니다.

예제

다음 코드 예제에서는 디자인 호스트에 대 한 참조를 가져올 다음 인터페이스의 ITemplate 인스턴스로 변환 content 하 고 적절 한 ControlParser 보기에 인스턴스를 할당 하는 개체를 만드는 참조를 사용 하는 방법을 보여 줍니다ITemplate.

// Create a template from the content string and  
// put it in the selected view.
public override void SetEditableDesignerRegionContent(EditableDesignerRegion region, string content)
{
    if (content == null)
        return;

    // Get a reference to the designer host
    IDesignerHost host = (IDesignerHost)Component.Site.GetService(typeof(IDesignerHost));
    if (host != null)
    {
        // Create a template from the content string
        ITemplate template = ControlParser.ParseTemplate(host, content);

        // Determine which region should get the template
        // Either 'Content0' or 'Content1'
        if (region.Name.EndsWith("0"))
            myControl.View1 = template;
        else if (region.Name.EndsWith("1"))
            myControl.View2 = template;
    }
}
' Create a template from the content string and put it 
' in the selected view. Called by the designer host?
Public Overrides Sub SetEditableDesignerRegionContent(ByVal region As EditableDesignerRegion, ByVal content As String)
    If IsNothing(content) Then
        Return
    End If

    ' Get a reference to the designer host
    Dim host As IDesignerHost = CType(Component.Site.GetService(GetType(IDesignerHost)), IDesignerHost)
    If Not IsNothing(host) Then
        ' Create a template from the content string
        Dim template As ITemplate = ControlParser.ParseTemplate(host, content)

        ' Determine which region should get the template
        If region.Name.EndsWith("0") Then
            myControl.View1 = template
        ElseIf region.Name.EndsWith("1") Then
            myControl.View2 = template
        End If

    End If
End Sub

설명

클래스에서 ControlDesigner 파생된 클래스는 디자인 화면에서 지역 기반 편집을 지원하고 메서드를 재정의 SetEditableDesignerRegionContent 하여 지정된 영역에 대한 콘텐츠를 설정할 수 있습니다.

적용 대상

추가 정보