T AddExpressionListener <T>(Func <T> expression) { recordingBindHandler = this; var result = expression.Invoke(); recordingBindHandler = null; return(result); }
//属性绑定,setter是从绑定源复制数据到目标的代码 //例子:BindProperty(() => obj2.a = obj1.a),表示obj2.a永远等于obj1.a //必须保证obj2是一个局部变量而不是属性 public BindHandler BindProperty(Action setter) { BindAction(e => setter()); recordingBindHandler = this; setter.Invoke(); recordingBindHandler = null; return(this); }