private void FillInfos(string title, StringBuilder sb, OnePropertyPathBinding binding) { if (binding != null) { sb.Append(title); foreach (PathItem item in binding.Items) { sb.AppendFormat("{0}.", item.IsBind ? item.PropertyName : "?"); } } }
/// <summary> /// constructeur par défaut /// </summary> /// <param name="source"></param> /// <param name="propertyPath"></param> /// <param name="destination"></param> /// <param name="propertyPathdest"></param> /// <param name="converter"></param> internal PropertyPathBindingItem(object sourceTarget, string propertyPath, object destinationTarget, string propertyPathdest, IBinderConverter converter, SynchronizationContext applyBindingContext) { _ApplyBindingContext = applyBindingContext; _Converter = converter; _DestinationBinding = new OnePropertyPathBinding(); _SourceBinding = new OnePropertyPathBinding(); _DestinationBinding.Bind(destinationTarget, propertyPathdest, delegate(int currentIndex, EqualityWeakReference weakSource) { //this delegate it's : "What to do when an intermediate property changing" return(delegate(object value) { if (weakSource.IsAlive) { _DestinationBinding.RemoveNotify(currentIndex); _DestinationBinding.BindPropertyPath(value, currentIndex); if (_CurrentBinding != null) { RecreateRealBinding(); } else { //rebind all level from source _SourceBinding.RemoveNotify(0); _SourceBinding.BindPropertyPath(this.Source, 0); } } }); }, null //delegate(int index, PropertyInfo pi, object src) //{ // ////Cas de la propriété à bindée // //EqualityWeakReference weakDest = new EqualityWeakReference(src); // //PathItem p = _DestinationBinding.Items[index]; // //p.Source = weakDest; //} ); ///Connect to the source _SourceBinding.Bind(sourceTarget, propertyPath, delegate(int currentIndex, EqualityWeakReference weakSource) { //this delegate it's : "What to do when an intermediate property changing" return(delegate(object value) { if (weakSource.IsAlive) { _SourceBinding.RemoveNotify(currentIndex); InternalUnBind(); _SourceBinding.BindPropertyPath(value, currentIndex); } }); }, //this delegate it's : "What to do when the final property changing" delegate(int index, PropertyInfo pi, object src) { RecreateRealBinding(); }); }