8

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>
0

1 Answer 1

6

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).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.