Ejemplo n.º 1
0
        internal override void Apply(bool fromTarget)
        {
            base.Apply(fromTarget);

            if (_expression == null)
            {
                _expression = new BindingExpression(this, SelfPath);
            }

            _expression.Apply(fromTarget);
        }
Ejemplo n.º 2
0
		public void ApplyNull()
		{
			const string path = "Foo.Bar";
			var binding = new Binding (path);
			var be = new BindingExpression (binding, path);
			Assert.DoesNotThrow (() => be.Apply (null, new MockBindable(), TextCell.TextProperty));
		}
Ejemplo n.º 3
0
		public void ApplyNull()
		{
			const string path = "Foo.Bar";
			var binding = new Binding(path);
			var be = new BindingExpression(binding, path);
			Assert.DoesNotThrow(() => be.Apply(null, new MockBindable(), TextCell.TextProperty));
		}
Ejemplo n.º 4
0
        void ApplyInner(Element templatedParent, BindableObject bindableObject, BindableProperty targetProperty)
        {
            if (_expression == null && templatedParent != null)
            {
                _expression = new BindingExpression(this, SelfPath);
            }

            _expression?.Apply(templatedParent, bindableObject, targetProperty);
        }
Ejemplo n.º 5
0
        public void BindingExpressionApply()
        {
            tlog.Debug(tag, $"BindingExpressionApply START");

            var testingTarget = new BindingExpression(new TemplateBinding(), selfpath);

            Assert.IsNotNull(testingTarget, "Can't create success object BindingExpression.");
            Assert.IsInstanceOf <BindingExpression>(testingTarget, "Should return BindingExpression instance.");

            try
            {
                using (View view = new View()
                {
                    Color = Color.Red
                })
                {
                    using (View preView = new View()
                    {
                        Color = Color.Cyan
                    })
                    {
                        BindableProperty property = BindableProperty.Create("myProperty", typeof(string), typeof(View), null, BindingMode.OneWay,
                                                                            null, null, null, null, null);

                        testingTarget.Apply(view, preView, property);
                        testingTarget.Apply(true);
                        testingTarget.Apply(false);
                        testingTarget.Unapply();
                    }
                }
            }
            catch (Exception e)
            {
                tlog.Debug(tag, e.Message.ToString());
                Assert.Fail("Caught Exception : Failed!");
            }

            tlog.Debug(tag, $"BindingExpressionApply END");
        }
Ejemplo n.º 6
0
        public void BindingExpressionApplyNullSource()
        {
            tlog.Debug(tag, $"BindingExpressionApplyNullSource START");

            var testingTarget = new BindingExpression(new TemplateBinding(), selfpath);

            Assert.IsNotNull(testingTarget, "Can't create success object BindingExpression.");
            Assert.IsInstanceOf <BindingExpression>(testingTarget, "Should return BindingExpression instance.");

            try
            {
                testingTarget.Apply(false);
            }
            catch (Exception e)
            {
                tlog.Debug(tag, e.Message.ToString());
                Assert.Fail("Caught Exception : Failed!");
            }

            tlog.Debug(tag, $"BindingExpressionApplyNullSource END");
        }