Skip to main content
You are viewing help content for pre-release software. This document and the features it describes are subject to change.
All docs
V25.2
  • AI-powered Report Localization in WPF Report Designer

    • 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.

      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?

    AI-powered Report Localization - WPF Report Designer, DevExpress

    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:

    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".
        }
    }
    

    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:

    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());
            }
        }
    }
    
    See Also