tags:

views:

1581

answers:

1

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" />
+1  A: 

Try out...

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

Found here. - SOFlow is already hitting top searches in google 8^D

Dillie-O
Interesting. The #x0a; syntax works inside the literal "Text=" attribute, but not if you embed it inside of the <TextBox.Text> element.
Matt Hamilton
@Matt: Yes I've observed this behavior as well. I'm not entirely sure why though.
emddudley