简体   繁体   English

无法在wpf文本框中粘贴所有文本

[英]Can't paste all text in wpf textbox

I have a simple window and textbox, when i try to paste this code to the textbox 当我尝试将此代码粘贴到文本框时,我有一个简单的窗口和文本框

[Code]General           : sample.avi
Format            : AVI
Length            : 380 MiB for 16mn 57s 320ms

Video #0          : DivX 5 at 2994 Kbps
Aspect            : 1024 x 576 () at 25.000 fps

Audio #0          : MPEG-1 Audio layer 3 at 128 Kbps
Infos             : 2 channels, 48.0 KHz   [/code]

It stops after 它停止了

[Code]General           : sample.avi

Why? 为什么?

您需要允许TextBox接受换行符:

AcceptsReturn="True"

Is the textbox set to accept new lines? 文本框是否设置为接受新行? Set these properties to the textbox: 将这些属性设置为文本框:

TextWrapping="Wrap" //Wrap text within the text box
VerticalScrollBarVisibility="Visible" //If you want scroll bars
AcceptsReturn="True" //This does the magic.

I probably spent a good hour or two on this. 我可能在这上花了一两个小时。 Ugh. 啊。 I finally noticed that the paste was stopping at a paragraph (ie, newline). 我终于注意到粘贴停在一个段落(即换行符)。 This insight allowed me to Google to something useful (this answer). 这种洞察力让我可以通过Google获得有用的东西(这个答案)。 Need keywords C# Paste Truncated Incomplete Newline or somesuch. 需要关键字C#Paste Truncated Incomplete Newline或somesuch。 I used C# years ago, and didn't have this issue. 我几年前用过C#,没有这个问题。 Thanks 谢谢

Make sure to allow multi-line by: 确保允许多行:

TextWrapping="Wrap" VerticalScrollBarVisibility="Visible" AcceptsReturn="True" TextWrapping =“Wrap”VerticalScrollBarVisibility =“Visible”AcceptsReturn =“True”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM