About line break codes and maximum number of characters in WPF text boxes
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
_This issue has been moved from [a ticket on Developer Community](https://developercommunity.visualstudio.com/t/About-line-break-codes-and-maximum-numbe/10781576)._
---
If AcceptsReturn is set to true in a WPF text box, input exceeding MaxLength will be possible in the following situation.
AcceptsReturn=true
MaxLength=4
1.Enter the following two lines in Text
a
b
2. With the caret at the beginning of the second line, press SHIFT+LEFT on the keyboard to select only the line break part.
3.Enter "c"
This operation allows input exceeding MaxLength.
---
## Repro
1. Create a new WPF application.
2. Add a TextBox control to the main window.
3. Set the AcceptsReturn property of the TextBox to true.
4. Set the MaxLength property of the TextBox to a specific value, such as 4.
5. Run the application.
6. In the TextBox, enter a multi-line text:
7. Type "a" on the first line.
8. Press Enter to move to the second line.
9. Type "b" on the second line.
10. Place the cursor at the beginning of the second line (before the "b").
11. Press SHIFT+LEFT to select the line break.
12. Enter any character.
At this point, you should observe that the input exceeds the set MaxLength.
### Original Comments
#### Feedback Bot on 4/11/2024, 07:28 AM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
Contributor guide
Assessment
This issue has not been assessed yet.