How can I use x:Static
with a multi binding as below?
<TextBlock.Text>
<MultiBinding StringFormat="{x:Static language:Resource.Message} : {0}">
<Binding Path="NoOfMessages" />
</MultiBinding>
</TextBlock.Text>
There is an error yelling at me with this code.
CodePudding user response:
use multiple inlines:
<TextBlock>
<Run Text="{x:Static language:Resource.Message}"/>
<Run Text=":"/>
<Run Text="{Binding NoOfMessages, Mode=OneWay}"/>
</TextBlock>
CodePudding user response:
As an alternative if you want to rely on MultiBinding
and StringFormat
:
<TextBlock.Text>
<MultiBinding StringFormat="{}{0} : {1}">
<Binding Source="{x:Static language:Resource.Message}"/>
<Binding Path="NoOfMessages" />
</MultiBinding>
</TextBlock.Text>
Make sure to use the escape sequence {}
for the braces.