PromptToExpressionBehavior Class
Converts natural language into valid filter and unbound column expressions for data-aware WPF controls.
Namespace: DevExpress.AIIntegration.Wpf
Assembly: DevExpress.AIIntegration.Wpf.v26.1.dll
Declaration
Remarks
PromptToExpressionBehavior converts a natural language into valid filter and unbound column expressions for data-aware WPF controls. Users can describe the desired expression behavior using their natural language instead of writing complex expressions. The system sends the resulting prompt to the configured AI service that generates a valid expression for the control. The Expression Editor or Filter Editor displays and validates the result immediately.
When the PromptToExpressionBehavior object is attached to GridControl or TreeListControl, both Expression Editor and Filter Editor display the AI prompt UI. Use EnableInExpressionEditor and EnableInFilterEditor properties to explicitly specify if the AI prompt UI is visible in corresponding editors.
To attach Prompt to Expression Behavior to a control, do the following:
Install AI-related NuGet packages and register an AI client.
Attach the
PromptToExpressionBehaviorto a supported control:<ThemedWindow xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid" xmlns:dxai="http://schemas.devexpress.com/winfx/2008/xaml/ai" xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"> <dxg:GridControl ItemsSource="{Binding Employees}"> <dxmvvm:Interaction.Behaviors> <dxai:PromptToExpressionBehavior RetryAttemptCount="3" Temperature="0.3" AugmentWithFunctionInfo="True" /> </dxmvvm:Interaction.Behaviors> </dxg:GridControl> </ThemedWindow>
Refer to the following help topic for additional information: Prompt to Expression.
Supported Controls
- GridControl (Expression Editor and Filter Editor)
- TreeListControl (Expression Editor and Filter Editor)
- ExpressionEditorControl (standalone Expression Editor)
- FilterEditorControl (standalone Filter Editor)