Skip to main content
All docs
V25.1
  • Localize Reports in the WinForms Report Designer

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

    WinForms Report Designer - AI-powered Localization

    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:

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

    Note

    Review the following help topic for information on how to register other supported AI services: How to Register an AI Client.

    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.

      Register AI-Powered Behaviors

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

    4. Add the Report Localization Behavior:

      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:

    using DevExpress.AIIntegration.WinForms.Reporting;
    // ...
    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();
            behaviorManager1.Attach<ReportLocalizationBehavior>(reportDesigner1, behavior => { });
        }
    }
    

    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.

    WinForms Report Designer - AI-powered Localization

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

    AI icon

    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?”

    Localization Editor -- Warning Message

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