Back to Devexpress

RepositoryItemTokenEdit.ValueMember Property

windowsforms-devexpress-dot-xtraeditors-dot-repository-dot-repositoryitemtokenedit-311e3020.md

latest3.9 KB
Original Source

RepositoryItemTokenEdit.ValueMember Property

If the Token Edit is connected to a data source, this property specifies which data source field stores unique Token values.

Namespace : DevExpress.XtraEditors.Repository

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

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

Property Value

TypeDefaultDescription
StringString.Empty

The name of a data source field that stores Token values.

|

Remarks

The DataSource property allows you to connect the editor to an external data source. Additionally, you need to set up two properties:

At design time, use the control’s smart tag menu to set up all three properties.

Tokens retrieved from a data source are not stored in the RepositoryItemTokenEdit.Tokens collection – this collection is always empty for a data-aware Token Edit.

If a data-aware Token Edit operates in “Manual” mode (see the EditMode property), users who type new values into the editor text box trigger the ProcessNewValue event. This event is similar to the ValidateToken event that raises for unbound Token Edit controls under same circumstances. It allows you to inspect the entered text (the e.Text property) and, if this text is valid, post it to a data source.

csharp
//a regular expression to validate entered values
Regex MyRegex = ...;

void TokenEdit1_ProcessNewValue(object sender, TokenEditProcessNewValueEventArgs e) {
    if (MyRegex.IsMatch(e.Text)) {
        //use data source API to post changes
        e.Handled = true;
    }
}
vb
'a regular expression to validate entered values
Dim MyRegex As Regex = ...

Private Sub TokenEdit1_ProcessNewValue(ByVal sender As Object, ByVal e As TokenEditProcessNewValueEventArgs)
    If MyRegex.IsMatch(e.Text) Then
        'use data source API to post changes
        e.Handled = True
    End If
End Sub

For more information on Token Edit, see the following help topic: Token Edit Control.

See Also

RepositoryItemTokenEdit Class

RepositoryItemTokenEdit Members

DevExpress.XtraEditors.Repository Namespace