Back to Devexpress

Modify Report Behavior in the WinForms Report Designer (CTP)

xtrareports-405498-ai-powered-functionality-desktop-reporting-modify-report-in-win-report-designer.md

latest9.9 KB
Original Source

Modify Report Behavior in the WinForms Report Designer (CTP)

  • Feb 10, 2026
  • 6 minutes to read

This help topic describes how to integrate the AI-powered Modify Reports functionality into the Report Designer. You can chat with an AI Assistant to make adjustments to your report layout. This functionality is available for .NET 8+.

Important

The Modify Report functionality is currently available as a community technology preview (CTP).

Install NuGet Packages

Install the following NuGet packages:

See the following help topics for information on how to obtain the DevExpress NuGet Feed and install DevExpress NuGet packages:

Note

DevExpress AI-powered extensions follow the “bring your own key” principle. DevExpress does not offer a REST API and does not ship any built-in LLMs/SLMs. You need an active Azure/Open AI subscription to obtain the REST API endpoint, key, and model deployment name. These variables must be specified at application startup to register AI clients and enable DevExpress AI-powered Extensions in your application.

Change Project SDK

Update the project SDK to Microsoft.NET.Sdk.Razor.

<Project Sdk="Microsoft.NET.Sdk.Razor">

Register AI Client

The following code snippet registers an Azure OpenAI client at application startup:

csharp
using Azure.AI.OpenAI;
using DevExpress.AIIntegration;
using Microsoft.Extensions.AI;
using System.ClientModel;

internal static class Program {
    static string AzureOpenAIEndpoint { get { return "AZURE_OPENAI_ENDPOINT"; } }
    static string AzureOpenAIKey { get { return "AZURE_OPENAI_APIKEY"; } }
    static string DeploymentName { get { return "MODEL_NAME"; } } // For example, gpt-4.1.
    [STAThread]
    static void Main(){
        IChatClient client = new AzureOpenAIClient(
            new Uri(AzureOpenAIEndpoint),
            new ApiKeyCredential(AzureOpenAIKey))
                .GetChatClient(DeploymentName).AsIChatClient(); 
        AIExtensionsContainerDesktop.Default.RegisterChatClient(client);
        ApplicationConfiguration.Initialize();
        Application.Run(new Form1());
    }
}
vb
Imports Azure.AI.OpenAI
Imports DevExpress.AIIntegration
Imports Microsoft.Extensions.AI
Imports System.ClientModel

Friend Module Program
    Private ReadOnly Property AzureOpenAIEndpoint() As String
        Get
            Return "AZURE_OPENAI_ENDPOINT"
        End Get
    End Property
    Private ReadOnly Property AzureOpenAIKey() As String
        Get
            Return "AZURE_OPENAI_APIKEY"
        End Get
    End Property
    Private ReadOnly Property DeploymentName() As String
        Get
            Return "MODEL_NAME"
        End Get
    End Property
        <STAThread>
        Sub Main()
        Dim client As IChatClient = (New AzureOpenAIClient(New Uri(AzureOpenAIEndpoint), New ApiKeyCredential(AzureOpenAIKey))).GetChatClient(DeploymentName).AsIChatClient()
        AIExtensionsContainerDesktop.Default.RegisterChatClient(client)
        ApplicationConfiguration.Initialize()
        Application.Run(New Form1())
        End Sub
End Module

Tip

How to Register OpenAI, Azure OpenAI, Ollama, and Semantic Kernel Clients.

Create and Configure a Behavior Object

Follow the steps below to attach a Report Modify Behavior to the WinForms Report Designer control at design time:

  1. Drop the BehaviorManager component from the Toolbox onto a Form that contains the Report Designer.
  2. Use the Edit Behaviors option in the BehaviorManager’s smart tag menu to access the behavior collection.
  3. Add a Report Modify Behavior and specify its settings:

Create and Configure a Behavior Object in Code

Use the following code to register a ReportModifyBehavior and attach it to the reportDesigner1 UI component created at design time from the Toolbox:

csharp
using DevExpress.AIIntegration.WinForms.Reporting;

public partial class Form1 : Form {
    public Form1() {
        InitializeComponent();
        behaviorManager1.Attach<ReportModifyBehavior>(reportDesigner1, behavior => {
           behavior.Properties.FixLayoutErrors = true;
           behavior.Properties.Temperature = 0.5f;
           behavior.Properties.RetryAttemptCount = 2;
        });
    }
}
vb
Imports DevExpress.AIIntegration.WinForms.Reporting

Public Partial Class Form1
    Inherits Form

    Public Sub New()
        InitializeComponent()
        behaviorManager1.Attach(Of ReportModifyBehavior)(reportDesigner1, Sub(behavior)
            behavior.Properties.FixLayoutErrors = True
            behavior.Properties.Temperature = 0.5F
            behavior.Properties.RetryAttemptCount = 2
        End Sub)
    End Sub
End Class

The following code registers a ReportModifyBehavior and attaches it to the WinForms Report Designer control (XRDesignMdiController):

csharp
using DevExpress.XtraReports.UI;
using DevExpress.AIIntegration.WinForms.Reporting;

public partial class Form1 : Form {
    public Form1() {
        InitializeComponent();
        // Create a new blank report instance or use your report.
        XtraReport report = new XtraReport();

        // Create a ReportDesignTool to configure and display the report in the Report Designer.
        ReportDesignTool designTool = new ReportDesignTool(report);

        // Attach AI-powered behavior to the Report Designer's MDI controller.
        behaviorManager1.Attach<ReportModifyBehavior>(designTool.DesignRibbonForm.DesignMdiController, behavior => {
            // Enable automatic layout error correction in the report.
            behavior.Properties.FixLayoutErrors = true;

            // Set the creativity level of AI suggestions (range: 0 = deterministic, 1 = creative).
            behavior.Properties.Temperature = 0.5f;

            // Define the number of retry attempts for AI operations in case of failure.
            behavior.Properties.RetryAttemptCount = 2;
        });

        // Display the Report Designer with a ribbon UI.
        designTool.ShowRibbonDesigner();
    }
}
vb
Imports DevExpress.XtraReports.UI
Imports DevExpress.AIIntegration.WinForms.Reporting

Public Partial Class Form1
    Inherits Form

    Public Sub New()
        InitializeComponent()
        ' Create a new blank report instance or use your report.
        Dim report As New XtraReport()

        ' Create a ReportDesignTool to configure and display the report in the Report Designer.
        Dim designTool As New ReportDesignTool(report)

        ' Attach AI-powered behavior to the Report Designer's MDI controller.
        behaviorManager1.Attach(Of ReportModifyBehavior)(designTool.DesignRibbonForm.DesignMdiController, Sub(behavior)
            ' Enable automatic layout error correction in the report.
            behavior.Properties.FixLayoutErrors = True

            ' Set the creativity level of AI suggestions (range: 0 = deterministic, 1 = creative).
            behavior.Properties.Temperature = 0.5F

            ' Define the number of retry attempts for AI operations in case of failure.
            behavior.Properties.RetryAttemptCount = 2
        End Sub)

        ' Display the Report Designer with a ribbon UI.
        designTool.ShowRibbonDesigner()
    End Sub
End Class

Note

Call the BehaviorInitializer.Initialize() method at application startup if your project targets the .NET Framework and you create AI-powered behaviors in code. Otherwise, an exception is thrown.

csharp
internal static class Program {
    [STAThread]
    static void Main() {
        //...
        // The Initialize() method forcibly initializes the behavior manager in .NET Framework apps.
        DevExpress.AIIntegration.WinForms.Reporting.BehaviorInitializer.Initialize();
        Application.Run(new Form1());
    }
}

Modify Reports

Once the behavior is registered, the Report Designer interface displays the AI Assistant panel.

The chat in the AI assistant window allows you to add and modify report elements using natural language. For example, you can execute commands such as:

  • Add/remove report bands

  • Add/remove report controls (labels, tables, barcodes, etc.)

  • Find report controls by name and modify associated properties (text, expression binding, background and foreground colors, etc.)

  • Modify report properties (margins, paper kind, etc.)

  • Group, sort, and filter report data

Note

The output quality depends on the details you specify in the natural language description. It is also influenced by the underlying language model — including its architecture, size, and training data. Different LLM implementations may yield varying results due to differences in model capabilities.