Back to Devexpress

AI-powered Report Localization in WinForms Report Designer

xtrareports-405435-ai-powered-functionality-desktop-reporting-destop-ai-localization.md

latest6.4 KB
Original Source

AI-powered Report Localization in WinForms Report Designer

  • Nov 24, 2025
  • 3 minutes to read

Follow instructions in this help topic to integrate AI-powered Localization functionality into the WinForms Report Designer.

Once you complete the steps below, the Localize with AI button appears in the Localization Editor. This button translates all localizable property values to the selected language:

Activate AI Assistant

Install NuGet Packages

Install the following NuGet packages:

Optional:

  • DevExpress.Win.Design (for .NET projects)

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 AI Assistant Behavior

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

  1. Drop the BehaviorManager component from the Toolbox onto a Form.

  2. (For .NET Framework Projects) Use the Register AI-Powered Behaviors option in the BehaviorManager’s smart tag menu to add the “AI-Powered Behaviors” submenu with report behaviors to BehaviorManager.

  3. Use the Edit Behaviors option in the BehaviorManager’s smart tag menu to access the behavior collection.

  4. Add the Report Localization Behavior:

Create and Configure AI Assistant Behavior at Runtime

The following code registers ReportLocalizationBehavior and attaches it to the WinForms Report Designer control:

csharp
using DevExpress.AIIntegration.WinForms.Reporting;
// ...
public partial class Form1 : Form {
    public Form1() {
        InitializeComponent();
        behaviorManager1.Attach<ReportLocalizationBehavior>(reportDesigner1, behavior => { });
    }
}
vb
Imports DevExpress.AIIntegration.WinForms.Reporting
' ...
Partial Public Class Form1
    Inherits Form

    Public Sub New()
        InitializeComponent()
        behaviorManager1.Attach(Of ReportLocalizationBehavior)(reportDesigner1, Sub(behavior)
        End Sub)
    End Sub
End Class

Localize Report

Invoke the Localization Editor. Click the “plus” above the left panel to select a new language. Click the Localize with AI button to translate all localizable property values to the selected language.

The AI icon appears next to the language when localization is complete:

Note

You can also localize a previously added language using AI. In this case, existing translated strings are replaced with AI-translated strings.

The following message appears when you click Apply or OK :

“You are about to apply a translation that may include AI-generated content. We recommend that you review all translated strings before you proceed. Do you want to continue?”

Click Yes to apply changes, or click No to return to the Localization Editor and review/edit AI-translated strings in the right panel.

See Also

AI-powered Report Localization in WPF Report Designer