Answered by:
Run Element Level control over text wrapping in text block to prevent splitting of a run

Question
-
Hello everyone, I am using a TextBlock which has embedded hyperlink elements inside the text. When this is resized, in some cases, the hyperlink is split onto multiple lines, because the Wrapping system seems to treat forward slashes as wrap points. I would like to override the behavior and tell the TextBlock that is cannot delimit any part of the hyperlink, and must move the entire block to the next line. How can I accomplish this?
ThreeSevenths
- Edited by ThreeSevenths Tuesday, May 25, 2010 5:55 PM spelling error
Answers
-
Hi,
In this case, we could modify Hyperlink with another TextBlock element without wrap, the code should be:
<TextBlock TextWrapping="WrapWithOverflow" > Is happy to have<TextBlock TextWrapping="NoWrap" > <Hyperlink>http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/8ceee7e9-e224-428a-aaec-b593a120f6b1</Hyperlink> on the case.
</TextBlock>
</TextBlock>Thanks.
Please remember to mark the replies as answers if they help and unmark them if they provide no help.- Marked as answer by Tim Li Monday, May 31, 2010 3:35 PM
All replies
-
Hi ThreeSevenths,
Do you have a code snippet that demonstartaes how your hyper link is placed? I would help us to give you more specifc answer if you describe your scenario as detail as possible.
Thanks.
Please remember to mark the replies as answers if they help and unmark them if they provide no help.- Proposed as answer by frippy_cmos Thursday, October 4, 2012 2:05 PM
- Unproposed as answer by frippy_cmos Thursday, October 4, 2012 2:06 PM
-
Hi Tim Li, I am placing them in a TextBlock element in a similar fashion to this:
<TextBlock TextWrapping="WrapWithOverflow" TextOptions.TextFormattingMode="Display"> Is happy to have <Hyperlink>http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/8ceee7e9-e224-428a-aaec-b593a120f6b1</Hyperlink> on the case. </TextBlock>
Thanks for your time.
ThreeSevenths
-
Hi,
In this case, we could modify Hyperlink with another TextBlock element without wrap, the code should be:
<TextBlock TextWrapping="WrapWithOverflow" > Is happy to have<TextBlock TextWrapping="NoWrap" > <Hyperlink>http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/8ceee7e9-e224-428a-aaec-b593a120f6b1</Hyperlink> on the case.
</TextBlock>
</TextBlock>Thanks.
Please remember to mark the replies as answers if they help and unmark them if they provide no help.- Marked as answer by Tim Li Monday, May 31, 2010 3:35 PM
-