Skip to main content
All docs
V26.1
  • 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

    public class PromptToExpressionBehavior :
        AIBehavior

    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.

    Run Demo: Prompt to Expression

    To attach Prompt to Expression Behavior to a control, do the following:

    1. Install AI-related NuGet packages and register an AI client.

    2. Attach the PromptToExpressionBehavior to 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

    Inheritance

    Object
    DispatcherObject
    DependencyObject
    Freezable
    Animatable
    DevExpress.Mvvm.UI.Interactivity.AttachableObjectBase
    DevExpress.Mvvm.UI.Interactivity.Behavior
    DevExpress.Mvvm.UI.Interactivity.Behavior<DependencyObject>
    DevExpress.AIIntegration.Wpf.Internal.AIBehavior
    PromptToExpressionBehavior
    See Also