public static void SetInheritedBindingContext(BindableObject bindable, object value) { BindablePropertyContext bpContext = bindable.GetContext(BindingContextProperty); if (bpContext != null && ((bpContext.Attributes & BindableContextAttributes.IsManuallySet) != 0)) { return; } object oldContext = bindable._inheritedContext; if (ReferenceEquals(oldContext, value)) { return; } if (bpContext != null && oldContext == null) { oldContext = bpContext.Value; } if (bpContext != null && bpContext.Binding != null) { bpContext.Binding.Context = value; bindable._inheritedContext = null; } else { bindable._inheritedContext = value; } bindable.ApplyBindings(skipBindingContext: false, fromBindingContextChanged: true); bindable.OnBindingContextChanged(); }