Back to Devexpress

Preview Reports with AI-generated Test Data (WPF Report Designer)

xtrareports-405567-ai-powered-functionality-desktop-reporting-preview-reports-with-ai-generated-test-data-wpf-report-designer.md

latest6.2 KB
Original Source

Preview Reports with AI-generated Test Data (WPF Report Designer)

  • Nov 24, 2025
  • 3 minutes to read

Users can generate AI-powered test data to preview reports without connecting to a live data source directly within the WPF Report Designer. Follow the instructions in this help topic to activate AI-generated Test Data in the Report Designer.

How It Works

Once AI-generated Test Data is activated, the Report Designer displays the Test Data tab. Click it to preview the report with AI-generated test data. The Report Designer requests data from an LLM and populates the report with meaningful values for preview.

Activate AI-powered Extension

Prerequisites

.NET8+ or .NET Framework v4.7.2+

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:

Register AI Client

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

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

namespace WPFReportApp {
    public partial class App : Application {
        static string AzureOpenAIEndpoint { get { return "YOUR_AUZURE_OPENAI_ENDPOINT"; } }
        static string AzureOpenAIKey { get { return "YOUR_AUZURE_OPENAI_API_KEY"; } }
        static string DeploymentName { get { return "MODEL_NAME"; } } // For example, gpt-4.1.

        static App() {
            CompatibilitySettings.UseLightweightThemes = true;
            IChatClient client = new AzureOpenAIClient(
                new Uri(AzureOpenAIEndpoint),
                new ApiKeyCredential(AzureOpenAIKey))
                    .GetChatClient(DeploymentName).AsIChatClient();
            AIExtensionsContainerDesktop.Default.RegisterChatClient(client);
        }
    }
}

Create and Configure Behavior Object

The following code snippet creates a ReportTestDataSourceBehavior and configures its RowCount and Temperature settings.

xaml
<dx:ThemedWindow
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    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"
    x:Class="DXWPFReportApp.MainWindow"
    Title="Report Designer" Height="800" Width="1000">
    <Grid>
        <dxrud:ReportDesigner x:Name="reportDesigner" Height="NaN" Width="NaN">
            <dxmvvm:Interaction.Behaviors>
                <dxai:ReportTestDataSourceBehavior x:Name="testDataSourceBehavior" RowCount="10" Temperature="0"/>
            </dxmvvm:Interaction.Behaviors>
        </dxrud:ReportDesigner>
    </Grid>
</dx:ThemedWindow>

Create and Configure Behavior Object in Code

The following code snippet registers a ReportTestDataSourceBehavior and attaches it to the WPF Report Designer (reportDesigner):

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

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

            var testDataSourceBehavior = new ReportTestDataSourceBehavior() {
                RowCount = 10,
                Temperature = 0
            };

            var behaviors = Interaction.GetBehaviors(reportDesigner);
            behaviors.Add(testDataSourceBehavior);

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

Namespace WPFReportApp
    Public Partial Class MainWindow
        Inherits ThemedWindow

        Public Sub New()
            InitializeComponent()

            Dim testDataSourceBehavior As New ReportTestDataSourceBehavior() With {
                .RowCount = 10,
                .Temperature = 0
            }

            Dim behaviors = Interaction.GetBehaviors(reportDesigner)
            behaviors.Add(testDataSourceBehavior)

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

See Also

Preview Reports with AI-generated Test Data (WinForms Report Designer)

Preview Reports with AI-generated Test Data (Web Report Designer)

Preview Reports with AI-generated Test Data in Visual Studio Report Designer