Can we concat two properties together in binding expression? If possible without converter or without writing two textblocks and setting them individually?
If you want to show, say FirstName
and LastName
, in a single TextBlock
, then you can do like this:
<TextBlock> <Run Text="{Binding FirstName}" /> <Run Text=" " /> <!-- space --> <Run Text="{Binding LastName}" /> </TextBlock>
Now, the TextBlock's Text
property will be "Sachin Tendulkar"
and will be displayed if:
FirstName = Sachin LastName = Tendulkar
Hope that helps.
<TextBlock.Text> <MultiBinding StringFormat="{}{0} , {1}"> <Binding Path="data1" /> <Binding Path="data2" /> </MultiBinding> </TextBlock.Text>
data1 and data2 are string properties which are binded.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With