Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why ever use a multi binding converter?

Couldn't I just use a single binding converter and as a parameter pass in the DataContext and from there pick what properties I want to use?

like image 440
Shai UI Avatar asked Jan 20 '23 20:01

Shai UI


2 Answers

If you pass the whole object instead of the individual properties, then the binding expression will not be re-evaluated when the individual properties change. You will be losing the benefit of the INotifyPropertyChanged mechanism.

like image 157
Rick Sladkey Avatar answered Jan 30 '23 13:01

Rick Sladkey


You might want to be more explicit and take in the minimum extra information (which is just generally good programming practice), or you may want information from more than one source - e.g. Your value might be dependent on a property of the datacontext and the checked state of a checkbox somewhere else in the view.

like image 33
Martin Harris Avatar answered Jan 30 '23 12:01

Martin Harris