DataGridViewCellStyle.WrapMode Property

Definition

Gets or sets a value indicating whether textual content in a DataGridView cell is wrapped to subsequent lines or truncated when it is too long to fit on a single line.

C#
public System.Windows.Forms.DataGridViewTriState WrapMode { get; set; }

Property Value

One of the DataGridViewTriState values. The default is NotSet.

Exceptions

The property value is not a valid DataGridViewTriState value.

Examples

The following code example illustrates the use of this property.

C#
this.dataGridView1.DefaultCellStyle.WrapMode =
    DataGridViewTriState.True;

Remarks

If WrapMode is False for a cell that contains text, the cell displays the text on a single line, and displays any embedded newline characters as box characters. If WrapMode is True for a cell that contains text, the cell displays newline characters as line breaks, but also wraps any lines that exceed the width of the cell.

Applies to

Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

See also