Bug 34545 - Binding Object not producing Binding error when binding fails do to lack of Path.
Summary: Binding Object not producing Binding error when binding fails do to lack of P...
Status: RESOLVED ANSWERED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.5.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Stephane Delcroix
URL:
Depends on:
Blocks:
 
Reported: 2015-10-03 06:08 UTC by David Strickland
Modified: 2015-10-14 12:35 UTC (History)
4 users (show)

Tags:
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:
Status:
RESOLVED ANSWERED

Description David Strickland 2015-10-03 06:08:45 UTC
Based on:

http://forums.xamarin.com/discussion/52456/why-doesnt-an-observablecollection-bound-to-a-label-via-a-convertor-fire-on-collectionchange#latest

When specifying a Binding If the Source is set but not the Path the binding appears to work at runtime but isn't actually bound to the underlying control. The value is initially populated but does not change when the button is clicked.

		public App ()
		{
			Button myButton = new Button ();
			myButton.Clicked += (sender, e) => {
				MyDateTime = DateTime.Now.ToString ();
			};

			Label label1 = new Label ();
			label1.BindingContext = null;
			var myBinding = new Binding ();
			myBinding.Source = MyDateTime;
			myBinding.Mode = BindingMode.OneWay;
			label1.SetBinding (Label.TextProperty, myBinding);

			MainPage = new ContentPage {
				Content = new StackLayout {
					VerticalOptions = LayoutOptions.Center,
					Children = {
						myButton,
						label1
					}
				}
			};
		}

There should be a binding error at runtime when the SetBinding fails to complete the attachment to the unspecified path but this doesn't seem to be happening.
Comment 1 Stephane Delcroix 2015-10-14 08:21:54 UTC
An unspecified path means the binding is applied to "self". In your case, the binding is applied correctly, but it's never triggered again as your Source doesn't implement INotifyPropertyChanged.
Comment 2 David Strickland 2015-10-14 12:35:01 UTC
You are of course correct sorry to waste the time.