Twoway databinding selectedItem in WPF listbox

Found this neat feature from Jonas’ ppt. What a great feature from WPF data-binding! See page 18.


2 thoughts on “Twoway databinding selectedItem in WPF listbox

  1. I gets even better when you don’t have to implement INotifiPropertyChanged or use ObservableCollection. Update Controls does all of that work for you.

    Part of the “annoying problem” that Martin Fowler was talking about was that the View Model (or as he called it the Presentation Model) has to subscribe to these events. The Presentation Model has to respond to changes in the Data Model. And then it has to republish those changes so that the View can respond to them. It becomes a real mess.

    But Update Controls takes a different approach. It works more like a spreadsheet. You just write the formulas and it figures out the dependencies. You never need to notify anybody.

    Say you create a spreadsheet where A1 is “=B1+C1”, and B1 is “=D1*2”. When you change D1, do you have to fire an event to B1? Does B1 then have to turn around and fire an event to A1? Of course not. The spreadsheet recognizes those dependencies and just updates things.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s