windowsforms-devexpress-dot-xtraeditors-dot-tokenedit-e40c6e1c.md
Occurs for all TokenEdit controls in the project.
Namespace : DevExpress.XtraEditors
Assembly : DevExpress.XtraEditors.v25.2.dll
NuGet Package : DevExpress.Win.Navigation
public static event EventHandler<TokenEdit.QueryAdvancedModeEventArgs> QueryAdvancedMode
Public Shared Event QueryAdvancedMode As EventHandler(Of TokenEdit.QueryAdvancedModeEventArgs)
The QueryAdvancedMode event's data class is TokenEdit.QueryAdvancedModeEventArgs. The following properties provide information specific to this event:
| Property |
|---|
| Editor |
| Parent |
| ParentForm |
| RepositoryItem |
| UseAdvancedMode |
The event data class exposes the following methods:
| Method |
|---|
| GetParent<TContainer>() |
The QueryAdvancedMode event fires for every TokenEdit control in the project and allows you to configure Advanced Mode settings based on your preferences.
The following code snippet handles the QueryAdvancedMode event to enable Advanced Mode and customize related options for all TokenEdit controls displayed on Form1:
using DevExpress.Utils;
using DevExpress.XtraEditors;
using System;
using System.Drawing;
using System.Windows.Forms;
namespace DXApplication {
internal static class Program {
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
TokenEdit.QueryAdvancedMode += TokenEdit1_QueryAdvancedMode;
Application.Run(new Form1());
}
static void TokenEdit1_QueryAdvancedMode(object sender, TokenEdit.QueryAdvancedModeEventArgs e) {
if(e.ParentForm is Form1) {
// Enable Advanced Mode
e.UseAdvancedMode = DefaultBoolean.True;
// Enable caret animation
e.Editor.Properties.AdvancedModeOptions.AllowCaretAnimation = DefaultBoolean.True;
// Animate selection
e.Editor.Properties.AdvancedModeOptions.AllowSelectionAnimation = DefaultBoolean.True;
// Set the selection color
e.Editor.Properties.AdvancedModeOptions.SelectionColor = Color.Yellow;
}
}
}
}
Imports DevExpress.Utils
Imports DevExpress.XtraEditors
Imports System
Imports System.Drawing
Imports System.Windows.Forms
Namespace DXApplication
Friend Module Program
<STAThread>
Sub Main()
Application.EnableVisualStyles()
Application.SetCompatibleTextRenderingDefault(False)
AddHandler TokenEdit.QueryAdvancedMode, AddressOf TokenEdit1_QueryAdvancedMode
Application.Run(New Form1())
End Sub
Private Sub TokenEdit1_QueryAdvancedMode(ByVal sender As Object, ByVal e As TokenEdit.QueryAdvancedModeEventArgs)
If TypeOf e.ParentForm Is Form1 Then
' Enable Advanced Mode
e.UseAdvancedMode = DefaultBoolean.True
' Enable caret animation
e.Editor.Properties.AdvancedModeOptions.AllowCaretAnimation = DefaultBoolean.True
' Animate selection
e.Editor.Properties.AdvancedModeOptions.AllowSelectionAnimation = DefaultBoolean.True
' Set the selection color
e.Editor.Properties.AdvancedModeOptions.SelectionColor = Color.Yellow
End If
End Sub
End Module
End Namespace
See Also