WindowsFormsHost.Child 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
WindowsFormsHost 요소에서 호스팅하는 자식 컨트롤을 가져오거나 설정합니다.
public:
property System::Windows::Forms::Control ^ Child { System::Windows::Forms::Control ^ get(); void set(System::Windows::Forms::Control ^ value); };
public System.Windows.Forms.Control Child { get; set; }
member this.Child : System.Windows.Forms.Control with get, set
Public Property Child As Control
속성 값
호스팅된 Windows Forms 컨트롤입니다.
예외
최상위 폼을 호스팅된 컨트롤로 할당하려고 한 경우
예제
다음 코드 예제를 사용 하는 방법에 설명 합니다 Child 호스트 된 컨트롤에 추가할 속성은 WindowsFormsHost 요소입니다. 자세한 내용은 연습: WPF에서 ActiveX 컨트롤 호스팅합니다.
private void Window_Loaded(object sender, RoutedEventArgs e)
{
// Create the interop host control.
System.Windows.Forms.Integration.WindowsFormsHost host =
new System.Windows.Forms.Integration.WindowsFormsHost();
// Create the ActiveX control.
var axWmp = new WmpAxLib.AxWindowsMediaPlayer();
// Assign the ActiveX control as the host control's child.
host.Child = axWmp;
// Add the interop host control to the Grid
// control's collection of child controls.
this.grid1.Children.Add(host);
// Play a .wav file with the ActiveX control.
axWmp.URL = @"C:\Windows\Media\tada.wav";
}
Private Sub Window_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
' Create the interop host control.
Dim host As New System.Windows.Forms.Integration.WindowsFormsHost()
' Create the ActiveX control.
Dim axWmp As New AxWMPLib.AxWindowsMediaPlayer()
' Assign the ActiveX control as the host control's child.
host.Child = axWmp
' Add the interop host control to the Grid
' control's collection of child controls.
Me.grid1.Children.Add(host)
' Play a .wav file with the ActiveX control.
axWmp.URL = "C:\Windows\Media\tada.wav"
End Sub
설명
하나의 자식 컨트롤을 호스팅할 수 있습니다, 있지만 Child 임의 개수의 자식 가질 수 있습니다.
자식 컨트롤에는 최상위 폼 일 수 없습니다.
경우 Child 은 Form, 양식의 ControlBox 속성이 false
합니다.
XAML 텍스트 사용
<
object >
<
hostedControl .../>
</
object >
XAML 값
개체 WindowsFormsHost 요소(또는 가능한 하위 클래스)입니다.
hostedControl 호스트된 Windows Forms 컨트롤을 지정하는 요소입니다. 태그에 사용자 지정 컨트롤은 일반적으로 xmlns 매핑이 필요 지정할 XAML 네임 스페이스 및 WPF XAML에 대 한 매핑을 Namespace합니다.