In Xamarin forms, we set a binding on a control like:
myLabel.SetBinding<MyViewModel>(Label.TextProperty, viewModel => viewModel.LabelText);
Is there a way to store the second parameter (the lambda expression) in a variable?
Based on this answer, I've tried:
Func<MyViewModel, string> myLambda = viewModel => viewModel.LabelText;
myLabel.SetBinding<MyViewModel>(Label.TextProperty, myLambda);
But the 2nd parameter gets a red underline with the error
cannot convert from 'System.Func<someViewModel, someType>' to 'System.Linq.Expressions<System.Func<someViewModel, object>>'