Is it possible to add more characters after a binding in xaml?

后端 未结 7 1052
小蘑菇
小蘑菇 2021-02-02 10:36

I was wondering something, and couldn\'t find any relevant topics. I have following binding :

Content=\"{x:Static resx:Resource.Form_OtherOption_Description}\"
<         


        
相关标签:
7条回答
  • 2021-02-02 11:28

    If you're using WPF 4.0, you could also do this:

    <TextBlock>
           <Run Text="{Binding SomeLabel}"/>
           <Run Text=":"/>
    </TextBlock>
    

    This actually concatenates the two strings coming from two Run tag and copied into TextBlock.Text property!.

    Using this approach you can even bind to different properties in presenter, and display it in a single TexBlock. See this excellent example:

    Can we concat two properties in data binding?

    0 讨论(0)
提交回复
热议问题