在我的 C#/WinRT 应用程序(Windows 应用商店应用程序)中,我有一个文本框。我可以将它的 TextWrapping 属性设置为 Wrap 或 NoWrap 并且它有效。但是,如果我尝试使用“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/