c# - TextWrapping 属性设置为 WrapWholeWords 时获取参数不正确错误?

标签 c# textbox windows-runtime windows-store-apps word-wrap

在我的 C#/WinRT 应用程序(Windows 应用商店应用程序)中,我有一个文本框。我可以将它的 TextWrapping 属性设置为 WrapNoWrap 并且它有效。但是,如果我尝试使用“WrapWholeWords”的值,则会出现设计时错误,并突出显示属性值。当我将鼠标悬停在错误上时,我收到错误消息“参数不正确”,错误代码为 E_RUNTIME_SETVALUE。任何人都可以告诉我为什么会发生这种情况,如果可以的话如何解决?

<TextBox x:Name="txtNotes" Grid.Column="2" TextWrapping="WrapWholeWords" Text="TextBlock" Margin="30" FontSize="20"/>

如果重要的话,TextBox 托管在网格控件上。请注意,WrapWholeWords 值由 Intellisense 从 XAML 编辑器和 IDE 的“属性编辑器” Pane 中提供。

最佳答案

这是不允许的。

TextBox and RichEditBox don't support the WrapWholeWords value for their TextWrapping properties. If you try to use WrapWholeWords as a value for TextBox.TextWrapping or RichEditBox.TextWrapping an invalid argument exception is thrown.

以上是从这个链接复制的: Link

关于c# - TextWrapping 属性设置为 WrapWholeWords 时获取参数不正确错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25496370/

相关文章:

c# - 包含/加入问题的 Entity Framework

excel - 使用 VBA 在 Excel 2013 的文本框中复制/操作格式化文本

javascript - 如何使用jquery动态生成的id来获取标签的值

mysql - 如何将mysql中文本框中的文本保存为utf-8

c# - 如何在 WinRT 中的按钮中将文本放置在图像上

windows-runtime - Windows Phone 8.1 运行时中缺少 DeviceFirmwareVersion、OSVersion、DeviceStatus

windows-8 - 在 MetroStyle 应用程序中使用 COM 对象

C# 为什么数组有 Length,集合有 Count?

c# - MVC 3 - 如何在异步 WCF 调用后立即 RedirectToAction

c# - LINQ 中用于遍历 HashSet<string> 的聪明替代方案