System.Windows.Forms.DataGridView.RowTemplate Property

Gets or sets the row that represents the template for all the rows in the control.

Syntax

[System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)]
[System.ComponentModel.Browsable(true)]
public DataGridViewRow RowTemplate { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

Sometimes you want greater control over the appearance of System.Windows.Forms.DataGridView rows than what is provided by the various System.Windows.Forms.DataGridView cell style properties. The DataGridView.RowTemplate property lets you create and initialize a System.Windows.Forms.DataGridViewRow for use as a template by all rows, including the row for new records if DataGridView.AllowUserToAddRows is true.

This is useful when you are setting default values for properties such as row height. For example, you may want to increase the default row height in order to provide extra room beneath ordinary cell content for displaying content that spans multiple columns.

Setting the row template is necessary when external data is displayed using custom types derived from the System.Windows.Forms.DataGridViewRow class. With unbound System.Windows.Forms.DataGridView controls, you can programmatically populate the DataGridView.Rows collection with instances of your custom row type. When displaying external data, however, the rows are generated automatically, but they are based on the row template, which you can set to an instance of your custom row type.

If this property has not been set the first time you retrieve its value, a new System.Windows.Forms.DataGridViewRow is created and returned.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0