Skip to main content

DataViewBase.UnboundExpressionEditorCreated Event

Fires after the Expression Editor has been invoked for an unbound column.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v24.2.Core.dll

NuGet Package: DevExpress.Wpf.Grid.Core

Declaration

public event UnboundExpressionEditorEventHandler UnboundExpressionEditorCreated

Event Data

The UnboundExpressionEditorCreated event's data class is UnboundExpressionEditorEventArgs. The following properties provide information specific to this event:

Property Description
AutoCompleteExpressionEditorControl Gets the Expression Editor in AutoComplete mode. Inherited from ExpressionEditorCreatedEventArgsBase.
Column Gets the column for which the expression editor is invoked. Inherited from ExpressionEditorCreatedEventArgsBase.
Expression Gets or sets the expression that is passed to the Expression Editor on its initialization. Inherited from ExpressionEditorCreatedEventArgsBase.
ExpressionEditorControl Gets the Expression Editor in Standard mode. Inherited from ExpressionEditorCreatedEventArgsBase.
ExpressionEditorMode Gets or sets the expression editor’s mode. Inherited from ExpressionEditorCreatedEventArgsBase.
Handled Gets or sets a value that indicates the present state of the event handling for a routed event as it travels the route. Inherited from RoutedEventArgs.
OriginalSource Gets the original reporting source as determined by pure hit testing, before any possible Source adjustment by a parent class. Inherited from RoutedEventArgs.
RoutedEvent Gets or sets the RoutedEvent associated with this RoutedEventArgs instance. Inherited from RoutedEventArgs.
Source Gets the View that raised the event.

The event data class exposes the following methods:

Method Description
InvokeEventHandler(Delegate, Object) When overridden in a derived class, provides a way to invoke event handlers in a type-specific way, which can increase efficiency over the base implementation. Inherited from RoutedEventArgs.
OnSetSource(Object) When overridden in a derived class, provides a notification callback entry point whenever the value of the Source property of an instance changes. Inherited from RoutedEventArgs.

Remarks

The UnboundExpressionEditorCreated event fires after the Expression Editor has been created, before it’s displayed. Handle this event to prevent the editor from being displayed or customize its settings.

The following code sample demonstrates how to customize the expression editor:

<dxg:GridControl>
   <!---->            
   <dxg:GridControl.View>
      <dxg:TableView UnboundExpressionEditorCreated="OnUnboundExpressionEditorCreated" />
   </dxg:GridControl.View>
</dxg:GridControl>
void OnUnboundExpressionEditorCreated(object sender, UnboundExpressionEditorEventArgs e) {
   var expressionEditorContext = e.AutoCompleteExpressionEditorControl.Context;   
   var nowFunction = expressionEditorContext.Functions.FirstOrDefault(f => string.Equals(f.Name, "now", StringComparison.OrdinalIgnoreCase));
   if (nowFunction != null) {
      expressionEditorContext.Functions.Remove(nowFunction);
   }   
   foreach (var columnInfo in expressionEditorContext.Columns) {
      columnInfo.Category = "Fields";
   }
}
See Also