Propagating INotifyPropertyChanged PropertyChanged in nested child objects

Feb 24, 2012 at 8:02 PM

I've been working with your framework but I found some limitations especially when binding to deep objects.

I was able to integrate a solution for that from Thomas Jaworski:

Found it through this question in StackOverflow:

All I had to do was add those three classes from Thomas and modified Binding.BinderBase.PushDataToModel() method:

                    //notifyContext.PropertyChanged += DataItem_PropertyChanged;
                    /** Propagate propertyChanged in nested child objects **/
                    var listener = ChangeListener.Create(this.DataContext as INotifyPropertyChanged);
                    listener.PropertyChanged += DataItem_PropertyChanged;

This seemed to do the trick for my simple tests, but now I need to test this thoroughly. 

You can test it in CommandBinding sample. Just delete EmployeeName property from the ViewModel and bind your literal to:

<asp:Literal ID="litEmployeeName" runat="server" Text='<%# sender.Bind("SelectedEmployee.EmployeeName") %>' />
instead of:
<asp:Literal ID="litEmployeeName" runat="server" Text='<%# sender.Bind("EmployeeName") %>' />
That way when you click the Command and change the SelectedEmployee.EmployeeName property it gets automatically refreshed in the
page now!
Just a suggestion for enhancing this great framework.