Read the previous parts of the series here,
- Quick Start Tutorial: Creating Universal Apps Via Xamarin - Part One
- Quick Start Tutorial: Creating Universal Apps Via Xamarin - Part Two
- Quick Start Tutorial: Creating Universal Apps via Xamarin: Label and Button - Part Three
- Quick Start Tutorial: Creating Universal Apps Via Xamarin: Device class - Part Four
- Quick Start Tutorial: Creating Universal Apps via Xamarin: Device Class (cont.) - Part Five
- Quick Start Tutorial: Creating Universal Apps Via Xamarin: Entry Control - Part Six
- Quick Start Tutorial: Creating Universal Apps Via Xamarin: StackLayout and Layout Options - Part Seven
- Quick Start Tutorial: Creating Universal Apps Via Xamarin: DisplayAlert and DisplayActionSheet - Part Eight
- Quick Start Tutorial: Creating Universal Apps Via Xamarin: Date Picker, Time Picker and Activity Indicator - Part Nine
- Quick Start Tutorial: Creating Universal Apps Via Xamarin: XAML And Resource Dictionary - Part Ten
- Quick Start Tutorial: Creating Universal Apps via Xamarin: Style in XAML - Part Eleven
- Quick Start Tutorial: Creating Universal Apps Via Xamarin: Style in XAML (Cont.) - Part Twelve
Data Binding
Data binding: communication between the two objects. One of the fantastic concepts in Xaml is once the communication takes place, there is no need to worry about the future assignment. Binding updates the data automatically, whenever source or target updates. Data binding says two objects are required; where one is the source and the other one is the Target.

Example
- <Label Text="{Binding MainText}" VerticalOptions="Center"
- HorizontalOptions="Center" />
- BindingContext = this;
- MainText = "Hello Welcome";

Source object is the main text as a string, and the Target Object: Label text is the target property. Generally, three questions will arise, which are:
- Which object will Xaml look for in the binding object?
- Where is the relation happening (Source and Target)?
- Whenever source object is changed; it updates the target property -- how is this magic happening?
Let's see:
BindingContext
BindingContext: Assign the view model object to this property. XAML will understand; i.e, where to look into the binding object.
In two way, we can assign this property specific to the control or the XAML BindingContext.
Control BindingContext
This is an option only based on the controls.
Ex: Label LblDemo;
LblDemo.BindingContext = this;
XAML BindingContext
If assigning to the xaml is (parent class) based, default it as applicable to all the controls.
- BindingContext = this; // Applicable to all the child controls






Santhakumar MunuswamyPosted Jun 30, 2016, 12:59 AM
Thank you for nice article
Vignesh ManiPosted Jun 28, 2016, 8:29 AM
Nice
kalu singh raoPosted Jun 28, 2016, 1:25 AM
Nice...