I have an input of a random string of twelve characters like this:
ABABABABABAB
I want them to display like this:
ABAB-ABAB-ABAB
How do I format a string in this way. I'm trying to use StringFormat, but it seems like the wrong approach.
<TextBlock>
<TextBlock.Text>
<Binding Path="Key" Mode="OneWay" StringFormat="???" />
</TextBlock.Text>
</TextBlock>
I don't think there is a direct format string that you could use to achieve the formatting you are looking for but you can implement your own IValueConverter and use it to format your string. Here's an example (it's for WP7 but the concept it the same).
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