I would bind a string property to text property like this: T开发者_开发问答ext="{Binding propertyName}
.
I also want to append a hardcoded string to this like Text="{Binding propertyName} appendedName
. How to do this?
Text="{Binding propertyName,StringFormat='Your property is: {}{0}'}"
You could use Run Text:
<TextBlock>
<Run Text="{Binding YourBinding}"/>
<Run Text="Suffix"/>
</TextBlock>
If you want to use it like this several times I would recommend a TemplatedControl where you have a Suffix DependencyProperty and a Text DependencyProperty.
You should create new property that returns text + appendedName.
Another way is to use several text blocks.
精彩评论