Back to Devexpress

AI-powered Report Localization in WPF Report Designer

xtrareports-405605-ai-powered-functionality-desktop-reporting-ai-powered-report-localization-wpf-report-designer.md

latest6.4 KB
Original Source

AI-powered Report Localization in WPF Report Designer

  • Nov 24, 2025
  • 3 minutes to read

Follow instructions in this help topic to integrate AI-powered Report Localization into the WPF Report Designer. AI-powered Report Localization allows you to translate report elements directly within the End-User Report Designer.

How It Works

  1. Open the Localization Editor.
  2. Click “+” to add a new language.
  3. Click Localize with AI to translate all localizable property values to the selected language.
  4. Click OK.
  5. The following message appears. Review translated strings and click Yes to confirm.

Note

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

Activate AI Assistant

Prerequisites

.NET8+ or .NET Framework v4.7.2+

Install NuGet Packages

This help topic uses Azure OpenAI. See the following help topic for information about NuGet packages required for other supported AI services: AI-powered Extensions.

Register AI Client

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

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

namespace DXReportsAILocalization {
    public partial class App : Application {
        static App() {
            CompatibilitySettings.UseLightweightThemes = true;
            var container = AIExtensionsContainerDesktop.Default;

            IChatClient chatClient = new AzureOpenAIClient(AzureOpenAIEndpoint, AzureOpenAIKey)
                .GetChatClient(ModelId).AsIChatClient();

            container.RegisterChatClient(chatClient);
        }

        private static Uri AzureOpenAIEndpoint = new Uri("YOUR_AZURE_OPENAI_END_POINT");
        private static ApiKeyCredential AzureOpenAIKey = new ApiKeyCredential("YOUR_OPENAI_API_KEY");
        static string ModelId = "YOUR_MODEL_NAME"; // For example, "gpt-4.1".
    }
}
vb
Imports DevExpress.AIIntegration
Imports DevExpress.Xpf.Core
Imports Azure.AI.OpenAI
Imports Microsoft.Extensions.AI
Imports System
Imports System.ClientModel
Imports System.Windows

Namespace DXReportsAILocalization
    Public Partial Class App
        Inherits Application

        Shared Sub New()
            CompatibilitySettings.UseLightweightThemes = True
            Dim container = AIExtensionsContainerDesktop.Default

            Dim chatClient As IChatClient = New AzureOpenAIClient(AzureOpenAIEndpoint, AzureOpenAIKey) _
                .GetChatClient(ModelId).AsIChatClient()

            container.RegisterChatClient(chatClient)
        End Sub

        Private Shared AzureOpenAIEndpoint As New Uri("YOUR_AZURE_OPENAI_END_POINT")
        Private Shared AzureOpenAIKey As New ApiKeyCredential("YOUR_OPENAI_API_KEY")
        Private Shared ModelId As String = "YOUR_MODEL_NAME" ' For example, "gpt-4.1".
    End Class
End Namespace

Tip

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

Create and Configure AI Assistant Behavior

Attach the ReportLocalizationBehavior to the Report Designer to enable AI-powered Localization:

xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxrud="http://schemas.devexpress.com/winfx/2008/xaml/reports/userdesigner" 
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:dxai="http://schemas.devexpress.com/winfx/2008/xaml/ai"

<dxrud:ReportDesigner x:Name="reportDesigner">
    <dxmvvm:Interaction.Behaviors>
        <dxai:ReportLocalizationBehavior/>
    </dxmvvm:Interaction.Behaviors>
</dxrud:ReportDesigner>

The following code snippet attaches the ReportLocalizationBehavior to the Report Designer in code behind:

csharp
using DevExpress.Xpf.Core;
using DevExpress.Mvvm.UI.Interactivity;
using DevExpress.AIIntegration.Wpf.Reporting;

namespace DXReportsAILocalization {
    public partial class MainWindow : ThemedWindow {
        public MainWindow() {
            InitializeComponent();

            ReportLocalizationBehavior reportLocalizationBehavior = new ReportLocalizationBehavior();
            Interaction.GetBehaviors(reportDesigner).Add(reportLocalizationBehavior);

            reportDesigner.OpenDocument(new Report1());
        }
    }
}
vb
Imports DevExpress.Xpf.Core
Imports DevExpress.Mvvm.UI.Interactivity
Imports DevExpress.AIIntegration.Wpf.Reporting

Namespace DXReportsAILocalization
    Public Partial Class MainWindow
        Inherits ThemedWindow

        Public Sub New()
            InitializeComponent()

            Dim reportLocalizationBehavior As New ReportLocalizationBehavior()
            Interaction.GetBehaviors(reportDesigner).Add(reportLocalizationBehavior)

            reportDesigner.OpenDocument(New Report1())
        End Sub
    End Class
End Namespace

See Also

AI-powered Report Localization in WinForms Report Designer

Choose Between Offline and Online DevExpress NuGet Feeds

Install NuGet Packages in Visual Studio, VS Code, and Rider