0

I have a simple WPF application with an empty TextBox. I would like the user to be able to copy rows of text (from one column) in Excel and paste the contents into the TextBox. My app will then format the text in a certain way.

When I paste the copied rows, the TextBox only contains the first row. WPF app with pasted rows

When I paste into Notepad all the items are pasted correctly. Rows pasted into Notepad with correct formatting

How can I get the same effect in my WPF app?

I have tried changing TextWrapping to NoWrap, Wrap, WrapWithOverflow. MaxLines is set to 2147483647. I don’t see any other Properties that make sense to change.

1
  • 2
    No, you should mark the answer below as correct to show that you've been helped. Commented Jul 12, 2017 at 13:05

1 Answer 1

1

It should work if you set the AcceptsReturn property of the TextBox to true:

<TextBox AcceptsReturn="True" Height="100" />
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.