示例#1
0
        public void TestBindRecursively()
        {
            //Arrange
            var root = new Foo <int>();

            root.SourceProperty = new Foo <int> .Bar();

            int handledCount = 0;

            EventBindingExtensions.BindRecursively <int>(root, propertyName: nameof(Foo <int> .Bar.Property), handle);

            //Act
            root.SourceProperty.Property = 2;
            void handle(object sender, PropertyMutatedEventArgs <int> e)
            {
                handledCount++;
            }

            //Assert
            Assert.AreEqual(1, handledCount);
        }
示例#2
0
 private static void Bind(INotifyPropertyChanged source, PropertyChangedEventHandler handler)
 {
     EventBindingExtensions.Bind(source, nameof(Foo <int> .SourceProperty), nameof(Foo <int> .Bar.Property), handler);
 }