windowsforms-devexpress-dot-xtraeditors-dot-tokenedittoken-1cfc1acf.md
Gets or sets the value. Token values must be unique.
Namespace : DevExpress.XtraEditors
Assembly : DevExpress.XtraEditors.v25.2.dll
NuGet Package : DevExpress.Win.Navigation
[DefaultValue(null)]
[DXCategory("Data")]
public virtual object Value { get; set; }
<DXCategory("Data")>
<DefaultValue(Nothing)>
Public Overridable Property Value As Object
| Type | Default | Description |
|---|---|---|
| Object | null |
The token value. Token values must be unique.
|
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()
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Value property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
winforms-tokenedit-checked-tokens/CS/TokenEdit_Glyph_InEndOfToken/Form1.cs#L51
{
XtraMessageBox.Show(string.Format("{0} {1} Checked: {2}", e.Token.Description, e.Token.Value, e.Token.Checked));
}
See Also