In this post we will examine one of the aspects of advanced databinding that many people find confusing. Binding . (that is, Binding dot). However, it is surprisingly easy to explain.
Binding . allows you to access the entire binding context.
This is best understood with an example
<StackLayout BindingContext="{x:Static sys:DateTime.Now}"
HorizontalOptions="Center"
VerticalOptions="Center">
<Label Text="{Binding Year, StringFormat='The year is {0}'}" />
<Label Text="{Binding StringFormat='The month is {0:MMMM}'}" />
<Label Text="{Binding Day, StringFormat='The day is {0}'}" />
<Label Text="{Binding StringFormat='The time is {0:T}'}" />
<Label Text="{Binding ., StringFormat='The full date is {0}'}" />
<Label Text="{Binding}" />
</StackLayout>
Here the stacklayout sets its BindingContext to DateTime.Now. That will allow us to bind to properties of the DateTime object that has the current local time. The first few lines are straight forward, we bind to properties of the DateTime object. For example,
Continue reading