WPF: Partial data binding in TextBlock
So here is my TextBlock
:
<TextBlock Text="1 Projects开发者_开发技巧 / 1 Issues"></TextBlock>
Using data binding I want replace 1 and 2 with {Binding Path=OpenProjects}
and {Binding Path=OpenIssues}
. What is the best way to do this?
P.S. I am not married to TextBlock
.
<TextBlock>
<TextBlock.Text>
<MultiBinding StringFormat="{}{0} Projects / {1} Issues">
<Binding Path="OpenProjects"/>
<Binding Path="OpenIssues"/>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
You should look into string format
精彩评论