0

C# has a function String.Format(string, arguments[]) which works like the following.

String.Format("here's my argument {0}", 1337)

This would return the string "here's my argument 1337". With the TextBlock object I'm having trouble getting functionality like this. I would like to do something like

<TextBlock Text=String.Format("here's my argument {0}", {Binding Argument})/>

Where it's taking a binding as an input but I can't seem to find any way to do this with a single TextBlock. Is there a similar object type which could handle this or is there some way to pull this off with text blocks?

Coat
  • 697
  • 7
  • 18

1 Answers1

4

You can use StringFormat for that

<TextBlock Text="{Binding Argument, StringFormat=here\'s my argument {0}}"/>
dkozl
  • 32,814
  • 8
  • 87
  • 89