TextBox::MinLines Property

 

Gets or sets the minimum number of visible lines.

Namespace:   System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

public:
property int MinLines {
	int get();
	void set(int value);
}

Property Value

Type: System::Int32

The minimum number of visible lines. The default is 1.

Exception Condition
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.

Identifier field

MinLinesProperty

Metadata properties set to true

AffectsMeasure

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
Available since 3.0
Return to top
Show: