by StefanOlson
28. April 2010 10:36
Update 29/June/2010: Colin Eberhardt who originally developed this technique has posted an update, including these changes: http://www.scottlogic.co.uk/blog/colin/2010/05/silverlight-multibinding-solution-for-silverlight-4/
The Silverlight multi-binding functionality that I have described previously (see here) doesn't work in Silverlight 4, due to the changes in the xaml parser. This code:
<local:MultiBinding TargetProperty="Text" Converter="{StaticResource TitleConverter}">
<Binding Path="Surname"/>
<Binding Path="Forename"/>
</local:MultiBinding>
Gives this exception:
System.Windows.Markup.XamlParseException: Set property 'SLMultiBinding.MultiBinding.Bindings' threw an exception
the solution is to wrap the bindings in a binding collection, e.g:
<local:MultiBinding TargetProperty="Text" Converter="{StaticResource TitleConverter}">
<local:BindingCollection>
<Binding Path="Surname"/>
<Binding Path="Forename"/>
</local:BindingCollection>
</local:MultiBinding>
You also need to download the latest version of the MultiBinding.cs file, from here
d0a50f89-b356-4299-89c5-4ea4f5ba8f5b|1|5.0
Tags:
Silverlight