资 源 简 介
Observal is a library that helps you to manage complex, hierarchical object models in your WPF applications.
Getting started
We start by creating an observer, which tracks a set of items:
var observer = new Observer();
To put the observer to use, we use extensions. For example, the PropertyChangedExtension allows us to be notified any time a property changes on a tracked object:
observer.Extend(new PropertyChangedExtension()) .WhenPropertyChanges(x => Console.WriteLine("Property {0} of object {1} changed", x.PropertyName, x.Source));
We can now add items to the observer for tracking:
observer.Add(customer1);observer.Add(customer2);observer.Add(customer3);
The extension automatically attaches to added items - in this case, it will print whenever an item property is changed.
customer2.Age = 23; // Prints "Property Age of object Cus