BindableObject.SetBinding(BindableProperty, BindingBase) Метод

Определение

Присваивает привязку свойству.

public void SetBinding (Xamarin.Forms.BindableProperty targetProperty, Xamarin.Forms.BindingBase binding);
member this.SetBinding : Xamarin.Forms.BindableProperty * Xamarin.Forms.BindingBase -> unit

Параметры

targetProperty
BindableProperty

Свойство BindableProperty, для которого необходимо задать привязку.

binding
BindingBase

Задаваемая привязка.

Комментарии

В следующем примере показано, как задать для привязки свойство :

var label = new Label ();
label.SetBinding (Label.TextProperty, new Binding ("Name"));
label.BindingContext = new {
    Name = "John Doe",
    Company = "Xamarin"
};

Debug.WriteLine (label.Text); // prints "John Doe"

Применяется к