Question

Is there anyway in XAML only to have a linebreak in a TextBox?

I know I can set myTextBox.Text = "something\r\nsomething2" in Code, but I can't do this:

<TextBox x:Name="myTextBox">
    <TextBox.Text>
        Something
        <Linebreak/>
        Something2
    </TextBox.Text>
</TextBox>

or this

<TextBox x:Name="myTextBox" Text="something\r\nsomething2" />
Was it helpful?

Solution

Try out...

<TextBox x:Name="myTextBox" Text="something1&#x0a;something2" />

Found here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top