Back to Devexpress

TreeList.NewItemRowText Property

windowsforms-devexpress-dot-xtratreelist-dot-treelist-04731de5.md

latest3.8 KB
Original Source

TreeList.NewItemRowText Property

Gets or sets the text displayed in the New Item Row when it is not focused.

Namespace : DevExpress.XtraTreeList

Assembly : DevExpress.XtraTreeList.v25.2.dll

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

Declaration

csharp
[DefaultValue("")]
[DXCategory("Appearance")]
[XtraSerializableProperty]
public string NewItemRowText { get; set; }
vb
<DefaultValue("")>
<XtraSerializableProperty>
<DXCategory("Appearance")>
Public Property NewItemRowText As String

Property Value

TypeDefaultDescription
StringString.Empty

A string value that specifies the text displayed in the New Item Row when it is not focused.

|

Remarks

When the New Item Row is located at the top of the list, it displays the default caption — “Click here to add a new row”.

You can use the localization service to localize the default text. Use the TreeListStringId.NewItemRowText field to identify the string.

You can also use the TreeList.NewItemRowText property to provide a custom text. This custom text cannot be localized.

See New Item Row for more information.

Example

The code below shows how to use the localization service to localize the text displayed in the New Item Row. Use the TreeListStringId.NewItemRowText field to identify the string.

csharp
using DevExpress.XtraTreeList.Localization;

TreeListLocalizer.Active = new NodeContextMenuLocalizer();

public class NodeContextMenuLocalizer : TreeListLocalizer {
    public override string Language { get { return "English"; } }
    public override string GetLocalizedString(TreeListStringId id) {
        switch (id) {
            case TreeListStringId.NewItemRowText: return "New Node";
            default: return base.GetLocalizedString(id);
        }
    }
}
vb
Imports DevExpress.XtraTreeList.Localization

TreeListLocalizer.Active = New NodeContextMenuLocalizer()

Public Class NodeContextMenuLocalizer
    Inherits TreeListLocalizer

    Public Overrides ReadOnly Property Language() As String
        Get
            Return "English"
        End Get
    End Property
    Public Overrides Function GetLocalizedString(ByVal id As TreeListStringId) As String
        Select Case id
            Case TreeListStringId.NewItemRowText
                Return "New Node"
            Case Else
                Return MyBase.GetLocalizedString(id)
        End Select
    End Function
End Class

See Also

New Item Row

TreeList Class

TreeList Members

DevExpress.XtraTreeList Namespace