- BindableProperty.Create(nameof(BindingContext), typeof(object), typeof(BindableObject), default(object),
- BindingMode.OneWay, null, BindingContextPropertyChanged, null, null, BindingContextPropertyBindingChanging);
+ BindableProperty.Create(nameof(BindingContext), typeof(object), typeof(BindableObject), null, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) =>
+ {
+ var bindableObject = (BindableObject)bindable;
+ if (newValue != null)
+ {
+ bindableObject.bindingContext = newValue;
+ bindableObject.FlushBinding();
+ }
+ }),
+ defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
+ {
+ if (null != bindable.bindingContext)
+ {
+ return bindable.bindingContext;
+ }
+
+ if (bindable is Container container)
+ {
+ return container.Parent?.BindingContext;
+ }
+ else
+ {
+ return null;
+ }
+ }));