Bug 27229 - Failure with SetBinding<TSource>
Summary: Failure with SetBinding<TSource>
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.3.2
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2015-02-19 14:24 UTC by scott
Modified: 2015-06-29 08:14 UTC (History)
5 users (show)

Tags: AC
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description scott 2015-02-19 14:24:19 UTC
I'm using SetBinding<TSource> from the BindableObjectExtensions class, and seeing a case where binding updates don't happen.

I can actually see that it doesn't appear the infrastructure ever wires up an event handler for the property changed notification.

If I instead bind with: BindableObjectExtensions.SetBinding(this BindableObject self, BindableProperty targetProperty, string path, BindingMode mode = BindingMode.Default, IValueConverter converter = null, string stringFormat = null), 

everything works fine.

It appears that perhaps the Binding.GetBindingPath method is not correctly determining a binding path for my case.

Doesn't work:
            var totalCheckTime = new TextCell { Text = "Total Check Time" };
            totalCheckTime.SetBinding<HealthCheckPageModel>(TextCell.DetailProperty, vm => ((AsyncCommand<HealthCheck>)vm.DoHealthCheckCommand).Execution.Result.TotalTiming);
Works fine:
            var totalCheckTime = new TextCell { Text = "Total Check Time" };


I'm attempting to bind to a member of my view model that is declared like: 

 public IAsyncCommand DoHealthCheckCommand { get; private set; }

with initialization: 
 DoHealthCheckCommand = new AsyncCommand<HealthCheck>(token => this.healthCheckService.Get(token));

based on the ideas and writing here: https://msdn.microsoft.com/en-us/magazine/dn630647.aspx

   public class AsyncCommand<TResult> : AsyncCommandBase, INotifyPropertyChanged
  public NotifyTaskCompletion<TResult> Execution...