Skip to main content

TreeListOptionsView.NewItemRowPosition Property

Gets or sets whether the row that allows users to add new nodes at the root level is displayed at the top or bottom of the list, or not displayed.

Namespace: DevExpress.XtraTreeList

Assembly: DevExpress.XtraTreeList.v24.1.dll

NuGet Packages: DevExpress.Win.Navigation, DevExpress.Win.TreeList

Declaration

[DefaultValue(TreeListNewItemRowPosition.None)]
[XtraSerializableProperty]
public virtual TreeListNewItemRowPosition NewItemRowPosition { get; set; }

Property Value

Type Default Description
TreeListNewItemRowPosition None

A value that specifies the New Item Row position.

Available values:

Name Description
None

The New Item Row is not displayed.

Top

The New Item Row is displayed at the top of the list.

image

Bottom

The New Item Row is displayed at the bottom of the list.

image

Property Paths

You can access this nested property as listed below:

Object Type Path to NewItemRowPosition
TreeList
.OptionsView .NewItemRowPosition

Remarks

The tree list control supports the New Item Row — a row that is displayed at the top or bottom of the list and allows users to create a new root node.

image

Set the TreeList.OptionsView.NewItemRowPosition property to Top or Bottom to show the New-Item Row at the list’s corresponding side.

See New Item Row for more information.

Example

The code below shows how to initialize the Status, Start Date, and Due Date column values when a user focuses the New Item Row.

image

The TreeList.KeyFieldName property specifies the field name that contains node keys. A node’s key should be unique and cannot be empty. Since the column that corresponds to the key field is not typically shown in the tree list, the user cannot enter a value.

The code below also shows how to handle the TreeList.InitNewRow event to specify a key for a newly created node. In this example, the tree list uses integer values as node keys and the handler assigns the next available integer to the new node.

private void TreeList1_InitNewRow(object sender, DevExpress.XtraTreeList.TreeListInitNewRowEventArgs e) {
    e.SetValue("Status", 0);
    e.SetValue("StartDate", DateTime.Now);
    e.SetValue("DueDate", DateTime.Now.AddDays(7));
    e.SetValue("ID", treeList1.AllNodesCount);
}
See Also