user4137741
user4137741

Reputation:

TextBox with single line WPF

I'm using WPF.
I try to create single line TextBox not multi line.
What i'm trying is

<StackPanel Orientation="Horizontal">
     <TextBox Margin="5" VerticalAlignment="Center" Text="Single line" />
</StackPanel>


But when i tried to enter a text, the TextBox is multiline and not single line
How can i fix it?
Thanks.

Upvotes: 18

Views: 14256

Answers (1)

Shwed_Berlin
Shwed_Berlin

Reputation: 552

Per default the Textbox is singleline. Maybe you have defined some Style for Textbox?

Try to set TextWrapping="NoWrap" and AcceptsReturn="False" for your TextBox

Upvotes: 23

Related Questions