views:

45

answers:

1

I have a TextBlock. When its Text is bound as:

<Binding Path="Applicant2.Surname"/>

It works fine, however I want to include the Forenames so changed the binding to:

<MultiBinding StringFormat="{}{0} {1}">
    <Binding Path="Applicant2.Forenames"/>
    <Binding Path="Applicant2.Surname"/>
</MultiBinding>

This displays {DependencyProperty.UnsetValue} {DependencyProperty.UnsetValue} until the value is set the first time.

How can I stop this? Why do I not get the problem with the first simple binding?

+4  A: 

for a multibinding you need to add a fallback value if it is just blank then you can simply do:

<MultiBinding StringFormat="{}{0} {1}">
    <Binding Path="Applicant2.Forenames" FallbackValue=""/>
    <Binding Path="Applicant2.Surname" FallbackValue=""/>
</MultiBinding>
Leom Burke
thank you, saved me ages I already spent a lot of time searching.
David Ward