WPF文本框的多行 [英] Multiline for WPF TextBox

查看:90
本文介绍了WPF文本框的多行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个用于发送一些反馈的应用程序.

I am developing an app for sending some feedback.

基本上,我试图将TextBox用作注释,但是我习惯于WinForms MultiLine=true.我已经将MinLines设置为3了,但是如果用户能够在此块中的任何位置键入内容,例如希望按Enter键并执行点点操作,我都希望它可以.例如:

Basically I'm trying to make a TextBox for comments, but I'm used to the WinForms MultiLine=true. I've set MinLines to 3, which is getting there, but preferably I'd like it if the user is able to type wherever in this block - like press enter and do dot points sort of thing. For example:

- Item 1        blah
- Item 2                blahlb lahbvl   d

但是此刻所有文本都停留在一行上.

But at the moment the text all stays on one line.

- Item 1         blah - Item 2                      blahb blahb blah

这些评论将帮助填充已发送电子邮件的正文.将字符串放入电子邮件正文字符串时,如果我不能轻易保持相同的格式(可能看起来像发送时的样子,就像键入时的样子一样),这可能毫无意义.

These comments will then help fill the body of an email which is sent. It may be pointless if I can't easily keep the same formatting when putting this string into the email body string (so that it looks like it does when sent as it does when typed).

我能实现我想要的,还是必须将所有文本都留在一行上?

Can I achieve what I'm after or do I have to leave it as all text on one line?

推荐答案

在文本框上启用TextWrapping="Wrap"AcceptsReturn="True".

您可能还希望启用AcceptsTabSpellCheck.IsEnabled.

这篇关于WPF文本框的多行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆