开发者

WPF: Partial data binding in TextBlock

开发者 https://www.devze.com 2022-12-17 07:44 出处:网络
So here is my TextBlock: <TextBlock Text=\"1 Projects开发者_开发技巧 / 1 Issues\"></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

0

精彩评论

暂无评论...
验证码 换一张
取 消