Gets the property map, which determines how setting properties on the ElementHost control affects the hosted Windows Presentation Foundation (WPF) element.
Assembly: WindowsFormsIntegration (in WindowsFormsIntegration.dll)
The Windows Forms and WPF technologies have two similar but different property models. Property mapping supports interoperation between the two architectures. For more information, see Windows Forms and WPF Property Mapping.
The following code example demonstrates how to use the property to translate the Margin property for a hosted WPF element. For more information, see Walkthrough: Mapping Properties Using the ElementHost Control.
' 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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.