MultiBinding

At times, you want to bind a control property to multiple properties on the binding source object, taking each of those property values and merging them into a single value to be consumed by the target. This is known in WPF as a MultiBinding, but this feature is not available in Silverlight. Earlier in this chapter, we discussed combining the values of multiple properties together while data binding using a value converter, which is a way to get around this omission. WPF's MultiBinding does have the advantage of being a slightly more generic solution, but you could make the value converter solution a little more generic by passing the names of the source properties to use in the converter parameter. Colin Eberhardt has created a means for implementing MultiBindings in Silverlight, which you can obtain at http://www.scottlogic.co.uk/blog/colin/2010/08/silverlight-multibinding-updated-adding-support-for-elementname-and-twoway-binding/.

images Note If you are using the Model-View-ViewModel (MVVM) design pattern (discussed in Chapter 13), the need for a MultiBinding data binding is somewhat lessened, because you can simply add a new property to your ViewModel which exposes the combined property values that should be displayed in the view.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.186.92