WindowsFormsHost.PropertyMap Özellik

Tanım

Öğesinde özellikleri WindowsFormsHost ayarlamanın barındırılan Windows Forms denetimini nasıl etkilediğini belirleyen özellik eşlemesini alır.

C#
public System.Windows.Forms.Integration.PropertyMap PropertyMap { get; }

Özellik Değeri

PropertyMap

PropertyMap Özellikleri barındırılan Windows Forms denetimindeki özelliklerle eşleyenWindowsFormsHost.

Örnekler

Aşağıdaki kod örneği, özelliği için bir eşlemenin FlowDirection bir WindowsFormsHost denetime nasıl ekleneceğini gösterir.

C#
// The ReplaceFlowDirectionMapping method replaces the  
// default mapping for the FlowDirection property.
private void ReplaceFlowDirectionMapping()
{
    wfHost.PropertyMap.Remove("FlowDirection");

    wfHost.PropertyMap.Add(
        "FlowDirection",
        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 : 
            System.Windows.FlowDirection.LeftToRight;
}

Açıklamalar

Windows Forms ve WPF teknolojilerinin iki benzer ama farklı özellik modeli vardır. Özellik eşlemesi , iki mimari arasında birlikte çalışabilirliği destekler. Daha fazla bilgi için bkz. Windows Forms ve WPF Özellik Eşlemesi.

Şunlara uygulanır

Ürün Sürümler
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8
Windows Desktop 3.0, 3.1, 5, 6, 7

Ayrıca bkz.