Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

TextBox.MinLines Property

Gets or sets the minimum number of visible lines.

Namespace:  System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

member MinLines : int with get, set
<object MinLines="int" .../>

Property Value

Type: System.Int32
The minimum number of visible lines. The default is 1.

Identifier field

MinLinesProperty

Metadata properties set to true

AffectsMeasure

ExceptionCondition
Exception

MinLines is greater than MaxLines.

Getting this property returns the current value of MinLines. Setting this property causes the text box to resize if the number of visible lines is less than value specified by MinLines.

If the Height property is explicitly set on a TextBox, the MaxLines and MinLines property values are ignored.

The following example shows how to create a TextBox with a MinLines value of 1.

<Page  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <StackPanel>
    <TextBox 
      Text="Initial text in TextBox" 
      Width="200" 
      TextAlignment="Center"
      TextWrapping="Wrap" 
      MaxLength="500"
      MinLines="1" 
      MaxLines="5" />
  </StackPanel>
</Page>
No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft