ElementHost.Child 속성

정의

UIElement 컨트롤에서 호스팅하는 ElementHost를 가져오거나 설정합니다.

public:
 property System::Windows::UIElement ^ Child { System::Windows::UIElement ^ get(); void set(System::Windows::UIElement ^ value); };
[System.ComponentModel.Browsable(false)]
public System.Windows.UIElement Child { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.Child : System.Windows.UIElement with get, set
Public Property Child As UIElement

속성 값

UIElement

WPF(호스트된 Windows Presentation Foundation) 요소입니다.

특성

예제

다음 코드 예제에서는 호스트된 WPF 요소를 할당 하는 속성을 사용 Child 하는 방법을 보여 줍니다. 자세한 내용은 연습: Windows Forms 3차원 WPF 복합 컨트롤 호스팅을 참조하세요.

private void Form1_Load(object sender, EventArgs e)
{
    // Create the ElementHost control for hosting the
    // WPF UserControl.
    ElementHost host = new ElementHost();
    host.Dock = DockStyle.Fill;

    // Create the WPF UserControl.
    HostingWpfUserControlInWf.UserControl1 uc =
        new HostingWpfUserControlInWf.UserControl1();

    // Assign the WPF UserControl to the ElementHost control's
    // Child property.
    host.Child = uc;

    // Add the ElementHost control to the form's
    // collection of child controls.
    this.Controls.Add(host);
}
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    ' Create the ElementHost control for hosting the
    ' WPF UserControl.
    Dim host As New ElementHost()
    host.Dock = DockStyle.Fill

    ' Create the WPF UserControl.
    Dim uc As New HostingWpfUserControlInWf.UserControl1()

    ' Assign the WPF UserControl to the ElementHost control's
    ' Child property.
    host.Child = uc

    ' Add the ElementHost control to the form's
    ' collection of child controls.
    Me.Controls.Add(host)
End Sub

설명

하나의 요소만 호스팅할 수 있지만 Child 여러 자식 요소를 가질 수 있습니다.

적용 대상

추가 정보