Example #1
0
        public void When_DependencyProperty_Object_AttachedProperty()
        {
            var SUT = new MyObjectTest();

            SUT.MyProperty = 42;
            Assert.AreEqual(42, SUT.MyProperty);

            var props = MyObjectTest.MyPropertyProperty.GetMetadata(typeof(MyObjectTest));
        }
Example #2
0
        public void When_ExplicitSetBindingBetweenProperties_IsNotFallBackValue()
        {
            var source = new MyBindingSource {
                IntValue = 42
            };
            var target  = new MyControl();
            var target2 = new MyObjectTest();

            target.SetBinding(MyControl.MyPropertyProperty, new Binding {
                Source = source, Path = nameof(MyBindingSource.IntValue), Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.Explicit
            });
            target2.Binding(nameof(MyControl.MyProperty), nameof(MyControl.MyProperty), source: target, BindingMode.TwoWay);

            Assert.AreEqual(42, source.IntValue);
            Assert.AreEqual(42, target.MyProperty);
            Assert.AreEqual(42, target2.MyProperty);
        }