Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multi Silverlight databinding

Does anyone know if its possible to do a binding and (if not how to achieve the same effect) on the same property using more than one binding in sort of a template

i.e. A textblock that has Text bound in the expression

"{Binding Path=Contact.Title} {Binding Path=Contact.Firstname} {Binding Path=Contact.Surname}"

all in one text property

like image 476
almog.ori Avatar asked Dec 22 '22 10:12

almog.ori


2 Answers

Not a big deal just:

<TextBlock>
<Run Text="{Binding Path=Contact.Title}"/>
<Run Text="{Binding Path=Contact.Firstname}"/>
<Run Text="{Binding Path=Contact.Surname}"/>
</TextBlock>  
like image 126
Robin Perdomo Avatar answered Jan 04 '23 16:01

Robin Perdomo


AFAIK it's not possible.

This is one of the reasons to follow the MVVM pattern, create an intermediary view which reflects the data in a format that you actually want presented, so you would create a fullname property on that class that was a concatenation of those fields and then bind to that.

like image 21
mattmanser Avatar answered Jan 04 '23 16:01

mattmanser