RepositoryItemTokenEdit.DisplayMember Property
If the Token Edit is connected to a data source, this property specifies which data source field stores visible Token captions.
Namespace: DevExpress.XtraEditors.Repository
Assembly: DevExpress.XtraEditors.v24.1.dll
NuGet Package: DevExpress.Win.Navigation
Declaration
Property Value
Type | Default | Description |
---|---|---|
String | String.Empty | The name of the data source field that stores Token captions. |
Remarks
The DataSource property allows you to connect the editor to an external data source. Additionally, you need to set up two properties:
- RepositoryItemTokenEdit.ValueMember - a data source field that stores token values;
RepositoryItemTokenEdit.DisplayMember
- a data source field that stores visible token captions.
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.
//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;
}
}
For more information on Token Edit, see the following help topic: Token Edit Control.