Share via


ElementHost.PropertyMap 속성

정의

컨트롤의 속성 설정이 WPF(호스트된 Windows Presentation Foundation) 요소에 ElementHost 미치는 영향을 결정하는 속성 맵을 가져옵니다.

public:
 property System::Windows::Forms::Integration::PropertyMap ^ PropertyMap { System::Windows::Forms::Integration::PropertyMap ^ get(); };
[System.ComponentModel.Browsable(false)]
public System.Windows.Forms.Integration.PropertyMap PropertyMap { get; }
[<System.ComponentModel.Browsable(false)>]
member this.PropertyMap : System.Windows.Forms.Integration.PropertyMap
Public ReadOnly Property PropertyMap As PropertyMap

속성 값

PropertyMap

PropertyMap 호스트된 WPF 요소의 속성에 매핑 ElementHost 되는 A입니다.

특성

예제

다음 코드 예제에서는 호스트된 WPF 요소에 PropertyMap 대 한 속성을 변환 Margin 하는 속성을 사용 하는 방법을 보여 줍니다. 자세한 내용은 연습: ElementHost 컨트롤을 사용하여 속성 매핑을 참조하세요.

// The AddMarginMapping method adds a new property mapping
// for the Margin property.
private void AddMarginMapping()
{
    elemHost.PropertyMap.Add(
        "Margin",
        new PropertyTranslator(OnMarginChange));
}

// The OnMarginChange method implements the mapping 
// from the Windows Forms Margin property to the
// Windows Presentation Foundation Margin property.
//
// The provided Padding value is used to construct 
// a Thickness value for the hosted element's Margin
// property.
private void OnMarginChange(object h, String propertyName, object value)
{
    ElementHost host = h as ElementHost;
    Padding p = (Padding)value;
    System.Windows.Controls.Button wpfButton = 
        host.Child as System.Windows.Controls.Button;

    Thickness t = new Thickness(p.Left, p.Top, p.Right, p.Bottom );

    wpfButton.Margin = t;
}
' The AddMarginMapping method adds a new property mapping
' for the Margin property.
Private Sub AddMarginMapping()

    elemHost.PropertyMap.Add( _
        "Margin", _
        New PropertyTranslator(AddressOf OnMarginChange))

End Sub


' The OnMarginChange method implements the mapping 
' from the Windows Forms Margin property to the
' Windows Presentation Foundation Margin property.
'
' The provided Padding value is used to construct 
' a Thickness value for the hosted element's Margin
' property.
Private Sub OnMarginChange( _
ByVal h As Object, _
ByVal propertyName As String, _
ByVal value As Object)

    Dim host As ElementHost = h
    Dim p As Padding = CType(value, Padding)
    Dim wpfButton As System.Windows.Controls.Button = host.Child


    Dim t As New Thickness(p.Left, p.Top, p.Right, p.Bottom)

    wpfButton.Margin = t

End Sub

설명

Windows Forms 및 WPF 기술에는 두 가지 서로 유사 하지만 다른 속성 모델이 포함 됩니다. 속성 매핑 두 아키텍처 간의 상호 운용을 지원 합니다. 자세한 내용은 Windows Forms 및 WPF 속성 매핑을 참조하세요.

적용 대상

추가 정보