public static BindingHelper Create(XamFormsContext context, IShadow <BindableObject> shadow, Func <IShadow <BindableObject>, PrimitiveHolder> primitiveSelector = default)
        {
            var bh = new BindingHelper(context, shadow, primitiveSelector ?? ((b) => b.Item?.BindingContext as PrimitiveHolder));

            bh.MonitorBindingContextChanged();

            return(bh);
        }
        public PrimitiveDataTemplate(XamFormsContext context, IPrimitive primitive, Func <IShadow <BindableObject>, PrimitiveHolder> selector) : base(() =>
        {
            // create view
            using var transaction = Transaction.Create(isolated: true);
            var shadow            = (IShadow <BindableObject>)context.MapperFactory.Create(context, primitive, false);
            transaction.Commit();

            // setup binding class to track changes to the binding context and update things automatically.
            var bindingHelper = BindingHelper.Create(context, shadow, selector);

            // store the binding helper with the shadow
            shadow.State.Set(bindingHelper);

            return(shadow.Item);
        })
        {
        }