Q:

Adding a word in the middle of a value by using StringFormat

I met this problem today , by using binding ; I could binding a number of values in a xaml file , the value looks like 58000.1234 , 58000.2234 , 58431.100 etc. I want to add a word in the middle of this value , which it could turn out to be 58x000.1 ,58x000.2, 58x431.1
I found StringFormat could be a good method for dealing my problem , so I somehow tried this following code , 
<TextBlock Text="{Binding Distance, RelativeSource={RelativeSource TemplatedParent}, StringFormat='{}{0:0.#}'}" />

it manage the point value problem , but i still don't know how to add the x in the middle of my values .
StringFormat='distance {0:0.#} m'

This code can add words before and after value .

A:

Pretty simple, just add it to the format:
string.Format("{0:000 hello 000.00}", 123456);
//123 hello 456.00

Bear in mind that the zeros here are placeholders for values from right to left.  This is useful for formatting phone numbers too.
string.Format("{0:(000) 000-0000}", 8885551212);
//(888) 555-1212

Lastly, you can also use the hash (#) mark for a placeholder as well.
Here's the full documentation:
http://msdn.microsoft.com/en-us/library/0c899ak8(v=vs.110).aspx

A:

Try using string format like this:
<TextBlock Text="{Binding Number, StringFormat='{}##x###.#'}" />

That should do the trick.

