Grant Birchmeier
Grant Birchmeier

Reputation: 18504

WPF - can I prevent word-wrap on a phrase within a wrapping TextBlock?

Does WPF allow me to specify a section of text that should not be split up?

In my case, I have a URL as part of the text in a paragraph. I want word-wrapping, but I don't want it to split up that URL.

That is to say, this is ok:

The quick brown fox jumped over the
http://lazydog.example.com/blah/monkey/apple/carburetor again
and again and again.

but this is not ok:

The quick brown fox jumped over the http://lazydog.example.com/
blah/monkey/apple/carburetor again and again and again.

Can I somehow mark that URL (or any phrase) as not-splittable in WPF?

Upvotes: 2

Views: 247

Answers (1)

Grant Birchmeier
Grant Birchmeier

Reputation: 18504

The solution seems obvious in retrospect:

Simply put my non-word-wrapped part in a nested 'TextBlock' with word-wrap disabled.

Upvotes: 1

Related Questions