WindowsFormsHost.Child Özellik

Tanım

öğesi tarafından WindowsFormsHost barındırılan alt denetimi alır veya ayarlar.

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

Özellik Değeri

Control

Barındırılan Windows Forms denetimi.

Özel durumlar

Barındırılan denetim olarak üst düzey bir form atama girişiminde bulunuldu.

Örnekler

Aşağıdaki kod örneği, barındırılan Child denetimi WindowsFormsHost öğesine eklemek için özelliğinin nasıl kullanılacağını gösterir. Daha fazla bilgi için bkz. İzlenecek yol: WPF'de ActiveX Denetimi Barındırma.

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

Açıklamalar

Yalnızca bir alt denetim barındırılabilir, ancak Child herhangi bir sayıda alt öğeye sahip olabilir.

Alt denetim üst düzey bir form olamaz.

ise Child Formformun ControlBox özelliği olarak falseayarlanır.

XAML Metni Kullanımı

<Nesne >

<hostedControl .../>

</Nesne >

XAML Değerleri

Nesne Bir WindowsFormsHost öğe (veya olası bir alt sınıf).

hostedControl Barındırılan Windows Forms denetimini belirten bir öğe. İşaretlemede özel denetimi belirtmek için genellikle xmlns eşlemesi gerekir. Bkz. WPF XAML için XAML Ad Alanları ve Ad Alanı Eşlemesi.

Şunlara uygulanır

Ayrıca bkz.