ElementHost.PropertyMap Özellik
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
Denetimdeki özellikleri ayarlamanın barındırılan ElementHost Windows Presentation Foundation (WPF) öğesini nasıl etkileyeceğini belirleyen özellik eşlemesini alır.
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
Özellik Değeri
PropertyMap Barındırılan WPF öğesindeki özelliklerle eşleyen ElementHost bir.
- Öznitelikler
Örnekler
Aşağıdaki kod örneği, barındırılan bir WPF öğesinin PropertyMap özelliğini çevirmek için özelliğinin Margin nasıl kullanılacağını gösterir. Daha fazla bilgi için bkz . İzlenecek yol: ElementHost Denetimini Kullanarak Özellikleri Eşleme.
// 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
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.