The library was used as an experimental demo and is no longer maintained.
The functionality has been migrated to WpfExtensions.Binding, or get it from .
Automatically subscribe and unsubscribe all of INotifyPropertyChanged
objects in the expression you provided. It can analyze conditional expressions and raise the PropertyChanged
event when appropriate.
- Common
// ExpressionObserver.Observes<T>(Expression<Func<T>, Action<T, Exception>): void
ExpressionObserver.Observes(
() => a.BoolProp ? a.NestedProp.StringProp : a.StringProp,
(value, exception) =>
{
// On value changed
});
- Computed Property (like vue.js)
public class ViewModel : BindableBaseEx
{
public double RectangularArea => GetProperty(() => Width * Height);
}
Any expression will be parsed into a dependency graph and a conditional expression tree.
- Dependency Graph: Each dependency node corresponds to an property (or closure field) in the expression you provoded. When an
INPC
property changed, its corresponding dependency node will unsubscribe from the oldINPC
object and subscribe to the newINPC
object, and notify its downstream nodes to unsubscribe and subscribe. - Conditional Expression Tree: Control the activation state of dependency nodes, and an inactivated dependency node will not observe the
PropertyChanged
event. Maybe it can improve performance. - See 考不上三本也会实现数据绑定(三) for details.