top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to make View-to-View Data Binding in Xamarin.Forms with Xaml?

+1 vote
461 views
How to make View-to-View Data Binding in Xamarin.Forms with Xaml?
posted Nov 8, 2017 by Jdk

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

You can do it effectively the same way as the XAML example simply by setting your view's BindingContext to the other view.

var stepper = new Stepper();

var label = new Label {
BindingContext = stepper
};
label.SetBinding (Label.TextProperty, new Binding ("Value", stringFormat: "{0:F0}"));

Alternatively, you can set the Binding.Source:

var stepper = new Stepper();

var label = new Label();
label.SetBinding (Label.TextProperty, new Binding ("Value", stringFormat: "{0:F0}", source: stepper));

answer Jul 18, 2019 by Rushabh Verma R.
...