windowsforms-devexpress-dot-xtraeditors-dot-repository-dot-repositoryitemtokenedit-c4453f8a.md
Gets a collection of tokens.
Namespace : DevExpress.XtraEditors.Repository
Assembly : DevExpress.XtraEditors.v25.2.dll
NuGet Package : DevExpress.Win.Navigation
[DXCategory("Behavior")]
public TokenEditTokenCollection Tokens { get; }
<DXCategory("Behavior")>
Public ReadOnly Property Tokens As TokenEditTokenCollection
| Type | Description |
|---|---|
| DevExpress.XtraEditors.TokenEditTokenCollection |
A DevExpress.XtraEditors.TokenEditTokenCollection object that stores this TokenEdit control’s tokens.
|
Tokens (TokenEditToken) stored within the Tokens collection are divided into two groups:
Predefined tokens, added to the Tokens collection in code or at design-time via the editor’s smart tag (see the figure below).
Tokens added to the Tokens collection after the application was launched. This requires the RepositoryItemTokenEdit.TokenPopulateMode property set to the Default value. Refer to this link for details.
Items stored within the Tokens collection are displayed within the editor’s drop-down list if it is enabled (see the RepositoryItemTokenEdit.ShowDropDown property).
Read the following topic for additional information and examples: Token Edit Control.
In unbound mode, the TokenEdit stores tokens in the Properties.Tokens collection. The following example demonstrates how to add unbound tokens in code:
tokenEdit1.Properties.BeginUpdate();
// Token values must be unique.
tokenEdit1.Properties.Tokens.AddToken("Description string A", "value1");
tokenEdit1.Properties.Tokens.AddToken("Description string B", "value2");
// ... add more tokens
tokenEdit1.Properties.EndUpdate();
tokenEdit1.Properties.BeginUpdate()
' Token values must be unique.
tokenEdit1.Properties.Tokens.AddToken("Description string A", "value1")
tokenEdit1.Properties.Tokens.AddToken("Description string B", "value2")
' ... add more tokens
tokenEdit1.Properties.EndUpdate()
TokenEdit control to a data source.tokenEdit1.Properties.BeginUpdate();
tokenEdit1.Properties.DataSource = queryBindingSource;
tokenEdit1.Properties.DisplayMember = "EmailAddress";
tokenEdit1.Properties.ValueMember = "EmailAddressID";
tokenEdit1.Properties.EndUpdate();
tokenEdit1.Properties.BeginUpdate()
tokenEdit1.Properties.DataSource = queryBindingSource
tokenEdit1.Properties.DisplayMember = "EmailAddress"
tokenEdit1.Properties.ValueMember = "EmailAddressID"
tokenEdit1.Properties.EndUpdate()
See Also