Skip to content

Instantly share code, notes, and snippets.

@DVDPT
Created September 2, 2014 15:23
Show Gist options
  • Save DVDPT/1408e88d28608455be16 to your computer and use it in GitHub Desktop.
Save DVDPT/1408e88d28608455be16 to your computer and use it in GitHub Desktop.
Xamarin really simple binding
/*
class MonetaryAmount
{
double Amount {get;}
}
class Report
{
MonetaryAmount Ecpm {get;}
}
class DashboardInfo : INotifyPropertyChanged
{
Report TodaysReport {get;}
}
class ReportsController : INotifyPropertyChanged
{
DashboardInfo DashboardInfo {get;}
}
*/
var ecpmText = view.FindViewById<TextView>(Resource.Id.home_ecpm);
ViewModel.ReportsController.CreateBindingChain(c => c.DashboardInfo)
.CreateBinding(d => d.TodaysReport)
.BindTo(ecpmText, t => t.Text, report=>report.Ecpm.Amount.ToString());
ViewModel.ReportsController.CreateBindingChain(c => c.DashboardInfo)
.CreateBinding(d => d.TodaysReport)
.BindTo(ecpmText, report => report.Ecpm.Amount.ToString());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment