On the Grid , I have a TextBox :
<TextBox x:Uid="tboxWriteAMessage" Name="TboxInput" Margin="5" SelectionStart="0" Grid.Column="0" IsReadOnly="False" Style="{StaticResource TextBoxStyle1}" MinHeight="50" TextWrapping="Wrap" TextChanged="TboxInput_TextChanged" GotFocus="TboxInput_GotFocus" LostFocus="TboxInput_LostFocus" KeyDown="TboxInput_KeyDown" KeyUp="TboxInput_KeyUp"/> When you enter a string whose length exceeds the width of the text field, it is translated to a new line. With this, everything is fine. However, I cannot make the carriage move to a new line when pressing certain buttons.
I tried to do it like this:
TboxInput.Text += Environment.NewLine; Only it does not work as it should - takes the carriage to the very beginning of the text field.