public void Bind(object source, PropertyInfo piSource, object destination, PropertyInfo piDest, IBinderConverter converter, SynchronizationContext applyBindingContext) { weakSrc = new WeakReference(source); weakDst = new WeakReference(destination); _Converter = converter; _PropNameSource = piSource.Name; _PropNameDest = piDest.Name; gethandler = GetSetUtils.CreateGetHandler <TValueSource>(piSource); //le set handler devrait être sur le type destination if (_Converter != null) { _CurrentChanged = OnValueChanged1; sethandlerDest = GetSetUtils.CreateSetHandler <TValueDest>(piDest); } else { _CurrentChanged = OnValueChanged; sethandler = GetSetUtils.CreateSetHandler <TValueSource>(piDest); } DataBinder.AddNotify <TValueSource>(source, piSource.Name, gethandler, _CurrentChanged, applyBindingContext); }
/// <summary> /// it for intermediate notifications, to rebind /// </summary> /// <param name="current">concerned object</param> /// <param name="pathitem">real property name</param> /// <param name="onchanged">delegate to call, when propertyname changed</param> private void AddNotify(object current, string pathitem, OnChangeDelegate <object> onchanged) { PropertyInfo pi = current.GetType().GetProperty(pathitem); GetHandlerDelegate <object> gethandler = GetSetUtils.CreateGetHandler <object>(pi); DataBinder.AddNotify <object>(current, pathitem, gethandler, onchanged, null); }