PropertyMap Property

WindowsFormsHost.PropertyMap Property

Gets the property map that determines how setting properties on the WindowsFormsHost element affects the hosted Windows Forms control.

Namespace:  System.Windows.Forms.Integration
Assembly:  WindowsFormsIntegration (in WindowsFormsIntegration.dll)

public PropertyMap PropertyMap { get; }
You cannot set this property in XAML.

Property Value

Type: System.Windows.Forms.Integration.PropertyMap
A PropertyMap that maps WindowsFormsHost properties to properties on the hosted Windows Forms control.

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 shows how to add a mapping for the FlowDirection property to a WindowsFormsHost control.

// The ReplaceFlowDirectionMapping method replaces the   
// default mapping for the FlowDirection property. 
private void ReplaceFlowDirectionMapping()

        new PropertyTranslator(OnFlowDirectionChange));

// The OnFlowDirectionChange method translates a  
// Windows Presentation Foundation FlowDirection value  
// to a Windows Forms RightToLeft value and assigns 
// the result to the hosted control's RightToLeft property. 
private void OnFlowDirectionChange(object h, String propertyName, object value)
    WindowsFormsHost host = h as WindowsFormsHost;
    System.Windows.FlowDirection fd = (System.Windows.FlowDirection)value;
    System.Windows.Forms.CheckBox cb = host.Child as System.Windows.Forms.CheckBox;

    cb.RightToLeft = (fd == System.Windows.FlowDirection.RightToLeft ) ? 
        RightToLeft.Yes : RightToLeft.No;

// The cb_CheckedChanged method handles the hosted control's 
// CheckedChanged event. If the Checked property is true, 
// the flow direction is set to RightToLeft, otherwise it is 
// set to LeftToRight. 
private void cb_CheckedChanged(object sender, EventArgs e)
    System.Windows.Forms.CheckBox cb = sender as System.Windows.Forms.CheckBox;

    wfHost.FlowDirection = ( cb.CheckState == CheckState.Checked ) ? 
            System.Windows.FlowDirection.RightToLeft : 

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0

Community Additions

© 2015 Microsoft