Search code examples
c#textboxwindows-runtimewindows-store-appsword-wrap

Getting a parameter is incorrect error with TextWrapping property set to WrapWholeWords?


In my C#/WinRT app (Windows Store app) I have a TextBox. I can set it's TextWrapping property to Wrap or NoWrap and it works. But if I try to use the value of "WrapWholeWords" I get a design time error with the property value highlighted. When I mouse over the error I get the error message "the parameter is incorrect" with the error code E_RUNTIME_SETVALUE. Can anyone tell me why this is happening and how to fix it if I can?

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

The TextBox is hosted on a grid control if that matters. Note, the WrapWholeWords value is offered by Intellisense from the XAML editor and from the Property Editor pane in the IDE.


Solution

  • Its not allowed.

    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.

    Above was copied from this link: Link