This is more of a suggestion for Xamarin Forms binding done in C# -
It would be very interesting if you could specify the information normally supplied in a call to "SetBinding" at the point you are constructing a control using initializer syntax. This would allow C# specifications of UI layouts to flow more naturally (like xaml), and reduce the need for intermediate/temp variables.
Imagine something like this:
page.Content = new StackLayout
{
Children =
{
new Label {Text = "Filler",TextColor = Color.Blue, TextPropertyBinding = "ImportantText"},
new Button {Text = "PressMe", CommandPropertyBinding = "PressCommand"}
}
};
or even:
page.Content = new StackLayout
{
Children =
{
new Label {Text = "Filler",TextColor = Color.Blue, TextPropertyBinding = vm=> vm.ImportantText},
new Button {Text = "PressMe", CommandPropertyBinding = vm => vm.PressCommand}
}
};
Others agree? I know there are some complexities in this, but it would be very slick I believe.