Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        static void BindingContextPropertyBindingPropertyChanged(BindableObject bindable, object oldvalue, object newvalue)
        {
            object oldInheritedContext = bindable._inheritedContext;

            bindable._inheritedContext = null;
            bindable.ApplyBindings(oldInheritedContext ?? oldvalue, true);
            bindable.OnBindingContextChanged();
        }
Exemplo n.º 3
0
 static void BindingContextPropertyChanged(BindableObject bindable, object oldvalue, object newvalue)
 {
     bindable._inheritedContext = null;
     bindable.ApplyBindings(skipBindingContext: true, fromBindingContextChanged: true);
     bindable.OnBindingContextChanged();
 }