DotNet Mirror
  DNM facebook   DNM Google+   DNM Twitter   

WPF Multiline Textbox Example

By Ashok Nalam on 17 Jan 2014 | Category: WPF | Tagged: textbox 
This snippet shows how to create WPF multiline textbox
  Discuss Add Comment   |  
Add rating Rate this resource   


In Windows Forms, it's easier to set TextBox control as multiline by setting MultiLine="True". But with WPF,  you will not find multiline property for TextBox control. So in order to make WPF textbox as multline set below 3 properties
  1. AcceptsReturn="True" {If false you can not press enter key}
  2. TextWrapping="Wrap" {If NoWrap then text keeps on going to right side in same row}
  3. VerticalScrollBarVisibility="Visible" {If property is not set you have to use up/down keys or mouse wheel to see content}

Texbox Code

<TextBox AcceptsReturn="True" TextWrapping="NoWrap"  VerticalScrollBarVisibility="Visible"/>


<Window x:Class="DotNetMirror.WPFMultiLineTBWindow"
        Title="Demo : Multiline Textbox in WPF" Height="300" Width="300">
    <StackPanel Orientation="Vertical">
        <Label Content="Multiline Textbox in WPF"></Label>
        <TextBox Height="200"  Name="tbmlName" AcceptsReturn="True" TextWrapping="NoWrap"  VerticalScrollBarVisibility="Visible"/>


WPF Multiline Textbox Demo

  Discuss Add Comment    
Add rating Rate this resource   
About the Contributor
Member Since : 10 Dec 2012
Member Points (Level) : 8926  (Professional)
Location : INDIA
Home Page :
About : I am admin of this site.
Rate this resource
Add your Comment
Name Email WebSite
Captcha Refresh

Comments (2)
1. By ZAP on 05 Dec 2022

2. By ZAP on 05 Dec 2022