How to add label binding using Object Initializer in Xamarin Forms

Is there a way to use binding bindings inside a label using an object initializer in Xamarin Forms

a) Label lb = new Label();
   lb.setBinding(----);


b) new Label{
**Set Binding** ???
}
+4
source share
1 answer

No , you cannot use the object initializer to set the binding of controls.

( MSDN): , .

SetBinding Object , , .

SetBinding :

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

Source: https://habr.com/ru/post/1649765/


All Articles