Back to Devexpress

DataViewBase.UnboundExpressionEditorCreated Event

wpf-devexpress-dot-xpf-dot-grid-dot-dataviewbase-4d548bfd.md

latest7.0 KB
Original Source

DataViewBase.UnboundExpressionEditorCreated Event

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

Namespace : DevExpress.Xpf.Grid

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

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

csharp
public event UnboundExpressionEditorEventHandler UnboundExpressionEditorCreated
vb
Public Event UnboundExpressionEditorCreated As UnboundExpressionEditorEventHandler

Event Data

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

PropertyDescription
AutoCompleteExpressionEditorControlGets the Expression Editor in AutoComplete mode. Inherited from ExpressionEditorCreatedEventArgsBase.
ColumnGets the column for which the expression editor is invoked. Inherited from ExpressionEditorCreatedEventArgsBase.
ExpressionGets or sets the expression that is passed to the Expression Editor on its initialization. Inherited from ExpressionEditorCreatedEventArgsBase.
ExpressionEditorControlGets the Expression Editor in Standard mode. Inherited from ExpressionEditorCreatedEventArgsBase.
ExpressionEditorModeGets or sets the expression editor’s mode. Inherited from ExpressionEditorCreatedEventArgsBase.
HandledGets 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.
OriginalSourceGets the original reporting source as determined by pure hit testing, before any possible Source adjustment by a parent class. Inherited from RoutedEventArgs.
RoutedEventGets or sets the RoutedEvent associated with this RoutedEventArgs instance. Inherited from RoutedEventArgs.
SourceGets the View that raised the event.

The event data class exposes the following methods:

MethodDescription
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:

xaml
<dxg:GridControl>
   <!---->            
   <dxg:GridControl.View>
      <dxg:TableView UnboundExpressionEditorCreated="OnUnboundExpressionEditorCreated" />
   </dxg:GridControl.View>
</dxg:GridControl>
csharp
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

DataViewBase Class

DataViewBase Members

DevExpress.Xpf.Grid Namespace