# AI Assistant Extensions | WPF Controls | DevExpress Documentation

AI Assistant extensions allow you to enhance the way your users interact with and manage text content. These extensions leverage advanced natural language processing (NLP) technologies to offer automated, intelligent text manipulation capabilities directly within your WPF applications.

![AI Assistant - WPF Text Editor, DevExpress](/WPF/images/whats-new/24-2/24-2-wpf-memoedit-ai-assistant.png)

[Run Demo: AI Assistant](dxdemo://Wpf/AI/MainDemo/TextEditModule) [View Example: AI-powered Text Extensions](https://github.com/DevExpress-Examples/winforms-wpf-ai-text-extension)

## Applies To

- [Text Editor](/WPF/DevExpress.Xpf.Editors.TextEdit)
- [Rich Text Editor](/WPF/8651/controls-and-libraries/rich-text-editor)
- [Spreadsheet](/WPF/16118/controls-and-libraries/spreadsheet)
- [PDF Viewer](/WPF/16420/controls-and-libraries/pdf-viewer) (Summarize, Translate, and Ask AI only)
- [Document Preview](/WPF/9697/controls-and-libraries/printing-exporting/concepts/document-preview) (Document Summarization, Document Translation, and Inline Document Translation only)

## Activate AI Assistant

### 1. Install DevExpress NuGet Packages

1. `DevExpress.AIIntegration.Wpf`
2. `DevExpress.Wpf`

Refer to the following help topics for more information:

- [How to Install DevExpress Products](/GeneralInformation/116042/installation/install-products)
- [Install Packages from NuGet.org: Visual Studio, VS Code, and JetBrains Rider](https://go.devexpress.com/DevExpress_NuGet_Documentation.aspx)

### 2. Register AI Client

See the following help topic for information on required NuGet packages and system requirements: [Register an AI Client](/WPF/405223/ai-powered-extensions).

The following code snippet registers an Azure OpenAI client at application startup within the [AIExtensionsContainerDesktop](/CoreLibraries/DevExpress.AIIntegration.AIExtensionsContainerDesktop) container:

- C#
- VB.NET

<section id="tabpanel_-uorw8kNaQ_tabid-csharp" role="tabpanel" data-tab="tabid-csharp">
<pre><code data-code-links="{&quot;/ (DevExpress.AIIntegration)(?:;|$)/&quot;:&quot;/CoreLibraries/DevExpress.AIIntegration&quot;,&quot;/ (DevExpress.Xpf.Core)(?:;|$)/&quot;:&quot;/WPF/DevExpress.Xpf.Core&quot;,&quot;/ (System)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system&quot;,&quot;/ (System.Windows)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system.windows&quot;}" data-highlight-lines="[[19,22]]" class="lang-csharp">using Azure.AI.OpenAI;
using DevExpress.AIIntegration;
using DevExpress.Xpf.Core;
using Microsoft.Extensions.AI;
using System;
using System.Windows;

namespace AIAssistantApp {
    public partial class App : Application {
        static App() {
            CompatibilitySettings.UseLightweightThemes = true;
        }

        protected override void OnStartup(StartupEventArgs e) {
            base.OnStartup(e);
            ApplicationThemeHelper.ApplicationThemeName = &quot;Win11Light&quot;;

            // For example, ModelId = &quot;gpt-4o-mini&quot;
            IChatClient azureChatClient = new Azure.AI.OpenAI.AzureOpenAIClient(new Uri(AzureOpenAIEndpoint),
                new System.ClientModel.ApiKeyCredential(AzureOpenAIKey)).GetChatClient(ModelId).AsIChatClient();
            AIExtensionsContainerDesktop.Default.RegisterChatClient(azureChatClient);
        }
    }
}
</code></pre></section>
<section id="tabpanel_-uorw8kNaQ_tabid-vb" role="tabpanel" data-tab="tabid-vb" aria-hidden="true" hidden="hidden">
<pre><code data-code-links="{&quot;/ (DevExpress.AIIntegration)(?:;|$)/&quot;:&quot;/CoreLibraries/DevExpress.AIIntegration&quot;,&quot;/ (DevExpress.Xpf.Core)(?:;|$)/&quot;:&quot;/WPF/DevExpress.Xpf.Core&quot;,&quot;/ (System)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system&quot;,&quot;/ (System.Windows)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system.windows&quot;}" class="lang-vb">Imports Azure.AI.OpenAI
Imports DevExpress.AIIntegration
Imports DevExpress.Xpf.Core
Imports Microsoft.Extensions.AI
Imports System
Imports System.Windows

Namespace AIAssistantApp
    Partial Public Class App
        Inherits Application

        Shared Sub New()
            CompatibilitySettings.UseLightweightThemes = True
        End Sub

        Protected Overrides Sub OnStartup(ByVal e As StartupEventArgs)
            MyBase.OnStartup(e)
            ApplicationThemeHelper.ApplicationThemeName = &quot;Win11Light&quot;

            &#39; For example, ModelId = &quot;gpt-4o-mini&quot;
            Dim azureChatClient As IChatClient = New AzureOpenAIClient(New Uri(AzureOpenAIEndpoint), 
                New System.ClientModel.ApiKeyCredential(AzureOpenAIKey)).GetChatClient(ModelId).AsIChatClient()
            AIExtensionsContainerDesktop.Default.RegisterChatClient(azureChatClient)
        End Sub
    End Class
End Namespace
</code></pre></section>

### 3. Create and Configure AI Assistant Behaviors

To enable AI-powered functionality in a DevExpress WPF control, add `mvvm` and `ai` namespaces to the `Window` and attach the required AI-powered behaviors to the control.

The following example activates Change Style, Proofread, and Translate AI-powered extensions in a TextEdit control:

- XAML

<section id="tabpanel_I+1g9mrKVM_tabid-xaml" role="tabpanel" data-tab="tabid-xaml">
<pre><code data-highlight-lines="[[6],[7],[13],[14],[15],[16],[17],[18]]" class="lang-xaml">&lt;dx:ThemedWindow
    xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
    xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
    xmlns:dx=&quot;http://schemas.devexpress.com/winfx/2008/xaml/core&quot;
    xmlns:dxe=&quot;http://schemas.devexpress.com/winfx/2008/xaml/editors&quot;
    xmlns:dxmvvm=&quot;http://schemas.devexpress.com/winfx/2008/xaml/mvvm&quot; 
    xmlns:dxai=&quot;http://schemas.devexpress.com/winfx/2008/xaml/ai&quot;
    x:Class=&quot;AIAssistant.MainWindow&quot;
    Title=&quot;MainWindow&quot; Height=&quot;800&quot; Width=&quot;800&quot;&gt;
    &lt;Grid&gt;
        &lt;dxe:TextEdit TextWrapping=&quot;Wrap&quot; AcceptsReturn=&quot;True&quot; VerticalContentAlignment=&quot;Top&quot;&gt;
            &lt;dxmvvm:Interaction.Behaviors&gt;
                &lt;dxai:ChangeStyleBehavior x:Name=&quot;ChangeStyle&quot;/&gt;
                &lt;dxai:ProofreadBehavior x:Name=&quot;Proofread&quot;/&gt;
                &lt;dxai:TranslateBehavior x:Name=&quot;Translate&quot;&gt;
                    &lt;dxai:LanguageInfo Culture=&quot;de-DE&quot;/&gt;
                    &lt;dxai:LanguageInfo Culture=&quot;es-ES&quot;/&gt;
                &lt;/dxai:TranslateBehavior&gt;
            &lt;/dxmvvm:Interaction.Behaviors&gt;
        &lt;/dxe:TextEdit&gt;
    &lt;/Grid&gt;
&lt;/dx:ThemedWindow&gt;
</code></pre></section>

### 4. Define Shortcuts and Bind Commands

The following example defines a <kbd>Ctrl</kbd>+<kbd>Space</kbd> shortcut that executes the Shorten AI-powered extension. The example also defines a similar command for the button.

- XAML

<section id="tabpanel_I+1g9mrKVM-1_tabid-xaml" role="tabpanel" data-tab="tabid-xaml">
<pre><code data-highlight-lines="[[16],[17],[21]]" class="lang-xaml">&lt;dx:ThemedWindow
    xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
    xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
    xmlns:dx=&quot;http://schemas.devexpress.com/winfx/2008/xaml/core&quot;
    xmlns:dxe=&quot;http://schemas.devexpress.com/winfx/2008/xaml/editors&quot;
    xmlns:dxmvvm=&quot;http://schemas.devexpress.com/winfx/2008/xaml/mvvm&quot; 
    xmlns:dxai=&quot;http://schemas.devexpress.com/winfx/2008/xaml/ai&quot;
    x:Class=&quot;AIAssistant.MainWindow&quot;
    Title=&quot;MainWindow&quot; Height=&quot;800&quot; Width=&quot;800&quot;&gt;
    &lt;Grid&gt;
        &lt;dxe:TextEdit TextWrapping=&quot;Wrap&quot; AcceptsReturn=&quot;True&quot; VerticalContentAlignment=&quot;Top&quot;&gt;
            &lt;dxmvvm:Interaction.Behaviors&gt;
                &lt;dxai:ShortenBehavior x:Name=&quot;Shorten&quot;/&gt;
            &lt;/dxmvvm:Interaction.Behaviors&gt;
            &lt;dxe:TextEdit.InputBindings&gt;
                &lt;KeyBinding Gesture=&quot;Ctrl+Space&quot;
                            Command=&quot;{Binding ElementName=Shorten, Path=ShortenCommand}&quot;/&gt;
            &lt;/dxe:TextEdit.InputBindings&gt;
        &lt;/dxe:TextEdit&gt;
        &lt;Button Content=&quot;Shorten Selected Text&quot;
            Command=&quot;{Binding ElementName=Shorten, Path=ShortenCommand}&quot;/&gt;
    &lt;/Grid&gt;
&lt;/dx:ThemedWindow&gt;
</code></pre></section>

## Change Style

[ChangeStyleBehavior](/WPF/DevExpress.AIIntegration.Wpf.ChangeStyleBehavior) rephrases or paraphrases the selected text while retaining its original meaning. This behavior allows you to generate alternative versions of the same content to match a specific genre or format. You can choose from 12 predefined styles (see [WritingStyle](/CoreLibraries/DevExpress.AIIntegration.Extensions.WritingStyle)).

The following example activates the AI-powered “Change Style” extension in a TextEdit control:

- XAML

<section id="tabpanel_EcKafbH5F5_tabid-xaml" role="tabpanel" data-tab="tabid-xaml">
<pre><code data-highlight-lines="[[6],[7],[13]]" class="lang-xaml">&lt;dx:ThemedWindow
    xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
    xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
    xmlns:dx=&quot;http://schemas.devexpress.com/winfx/2008/xaml/core&quot;
    xmlns:dxe=&quot;http://schemas.devexpress.com/winfx/2008/xaml/editors&quot;
    xmlns:dxmvvm=&quot;http://schemas.devexpress.com/winfx/2008/xaml/mvvm&quot; 
    xmlns:dxai=&quot;http://schemas.devexpress.com/winfx/2008/xaml/ai&quot;
    x:Class=&quot;AIAssistant.MainWindow&quot;
    Title=&quot;MainWindow&quot; Height=&quot;800&quot; Width=&quot;800&quot;&gt;
    &lt;Grid&gt;
        &lt;dxe:TextEdit TextWrapping=&quot;Wrap&quot; AcceptsReturn=&quot;True&quot; VerticalContentAlignment=&quot;Top&quot;&gt;
            &lt;dxmvvm:Interaction.Behaviors&gt;
                &lt;dxai:ChangeStyleBehavior x:Name=&quot;ChangeStyle&quot;/&gt;
            &lt;/dxmvvm:Interaction.Behaviors&gt;
        &lt;/dxe:TextEdit&gt;
    &lt;/Grid&gt;
&lt;/dx:ThemedWindow&gt;
</code></pre></section>

## Change Tone

[ChangeToneBehavior](/WPF/DevExpress.AIIntegration.Wpf.ChangeToneBehavior) adjusts the tone of the text to meet audience or context requirements. This option helps tailor the voice of your content.

Tone styles include:

- Casual
- Confident
- Friendly
- Professional
- Straightforward

The following example activates the AI-powered “Change Tone” extension in a TextEdit control:

- XAML

<section id="tabpanel_Rjsas+hMt1_tabid-xaml" role="tabpanel" data-tab="tabid-xaml">
<pre><code data-highlight-lines="[[6],[7],[13]]" class="lang-xaml">&lt;dx:ThemedWindow
    xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
    xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
    xmlns:dx=&quot;http://schemas.devexpress.com/winfx/2008/xaml/core&quot;
    xmlns:dxe=&quot;http://schemas.devexpress.com/winfx/2008/xaml/editors&quot;
    xmlns:dxmvvm=&quot;http://schemas.devexpress.com/winfx/2008/xaml/mvvm&quot; 
    xmlns:dxai=&quot;http://schemas.devexpress.com/winfx/2008/xaml/ai&quot;
    x:Class=&quot;AIAssistant.MainWindow&quot;
    Title=&quot;MainWindow&quot; Height=&quot;800&quot; Width=&quot;800&quot;&gt;
    &lt;Grid&gt;
        &lt;dxe:TextEdit TextWrapping=&quot;Wrap&quot; AcceptsReturn=&quot;True&quot; VerticalContentAlignment=&quot;Top&quot;&gt;
            &lt;dxmvvm:Interaction.Behaviors&gt;
                &lt;dxai:ChangeToneBehavior x:Name=&quot;ChangeTone&quot;/&gt;
            &lt;/dxmvvm:Interaction.Behaviors&gt;
        &lt;/dxe:TextEdit&gt;
    &lt;/Grid&gt;
&lt;/dx:ThemedWindow&gt;
</code></pre></section>

## Expand

[ExpandBehavior](/WPF/DevExpress.AIIntegration.Wpf.ExpandBehavior) enriches your text with additional information or in-depth explanations.

The following example activates the AI-powered “Expand” extension in a TextEdit control:

- XAML

<section id="tabpanel_E+XyKZUJMa_tabid-xaml" role="tabpanel" data-tab="tabid-xaml">
<pre><code data-highlight-lines="[[6],[7],[13]]" class="lang-xaml">&lt;dx:ThemedWindow
    xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
    xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
    xmlns:dx=&quot;http://schemas.devexpress.com/winfx/2008/xaml/core&quot;
    xmlns:dxe=&quot;http://schemas.devexpress.com/winfx/2008/xaml/editors&quot;
    xmlns:dxmvvm=&quot;http://schemas.devexpress.com/winfx/2008/xaml/mvvm&quot; 
    xmlns:dxai=&quot;http://schemas.devexpress.com/winfx/2008/xaml/ai&quot;
    x:Class=&quot;AIAssistant.MainWindow&quot;
    Title=&quot;MainWindow&quot; Height=&quot;800&quot; Width=&quot;800&quot;&gt;
    &lt;Grid&gt;
        &lt;dxe:TextEdit TextWrapping=&quot;Wrap&quot; AcceptsReturn=&quot;True&quot; VerticalContentAlignment=&quot;Top&quot;&gt;
            &lt;dxmvvm:Interaction.Behaviors&gt;
                &lt;dxai:ExpandBehavior x:Name=&quot;Expand&quot;/&gt;
            &lt;/dxmvvm:Interaction.Behaviors&gt;
        &lt;/dxe:TextEdit&gt;
    &lt;/Grid&gt;
&lt;/dx:ThemedWindow&gt;
</code></pre></section>

## Explain

[ExplainBehavior](/WPF/DevExpress.AIIntegration.Wpf.ExplainBehavior) transforms text into more understandable terms that make complex content more accessible and understandable.

The following example activates the AI-powered “Explain” extension in a TextEdit control:

- XAML

<section id="tabpanel_rR-RC4Ry0n_tabid-xaml" role="tabpanel" data-tab="tabid-xaml">
<pre><code data-highlight-lines="[[6],[7],[13]]" class="lang-xaml">&lt;dx:ThemedWindow
    xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
    xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
    xmlns:dx=&quot;http://schemas.devexpress.com/winfx/2008/xaml/core&quot;
    xmlns:dxe=&quot;http://schemas.devexpress.com/winfx/2008/xaml/editors&quot;
    xmlns:dxmvvm=&quot;http://schemas.devexpress.com/winfx/2008/xaml/mvvm&quot; 
    xmlns:dxai=&quot;http://schemas.devexpress.com/winfx/2008/xaml/ai&quot;
    x:Class=&quot;AIAssistant.MainWindow&quot;
    Title=&quot;MainWindow&quot; Height=&quot;800&quot; Width=&quot;800&quot;&gt;
    &lt;Grid&gt;
        &lt;dxe:TextEdit TextWrapping=&quot;Wrap&quot; AcceptsReturn=&quot;True&quot; VerticalContentAlignment=&quot;Top&quot;&gt;
            &lt;dxmvvm:Interaction.Behaviors&gt;
                &lt;dxai:ExplainBehavior x:Name=&quot;Explain&quot;/&gt;
            &lt;/dxmvvm:Interaction.Behaviors&gt;
        &lt;/dxe:TextEdit&gt;
    &lt;/Grid&gt;
&lt;/dx:ThemedWindow&gt;
</code></pre></section>

## Proofread

[ProofreadBehavior](/WPF/DevExpress.AIIntegration.Wpf.ProofreadBehavior) reviews the text for spelling, grammar, punctuation, and style errors.

The following example activates the AI-powered “Proofread” extension in a TextEdit control:

- XAML

<section id="tabpanel_SPodZ5JPuO_tabid-xaml" role="tabpanel" data-tab="tabid-xaml">
<pre><code data-highlight-lines="[[6],[7],[13]]" class="lang-xaml">&lt;dx:ThemedWindow
    xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
    xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
    xmlns:dx=&quot;http://schemas.devexpress.com/winfx/2008/xaml/core&quot;
    xmlns:dxe=&quot;http://schemas.devexpress.com/winfx/2008/xaml/editors&quot;
    xmlns:dxmvvm=&quot;http://schemas.devexpress.com/winfx/2008/xaml/mvvm&quot; 
    xmlns:dxai=&quot;http://schemas.devexpress.com/winfx/2008/xaml/ai&quot;
    x:Class=&quot;AIAssistant.MainWindow&quot;
    Title=&quot;MainWindow&quot; Height=&quot;800&quot; Width=&quot;800&quot;&gt;
    &lt;Grid&gt;
        &lt;dxe:TextEdit TextWrapping=&quot;Wrap&quot; AcceptsReturn=&quot;True&quot; VerticalContentAlignment=&quot;Top&quot;&gt;
            &lt;dxmvvm:Interaction.Behaviors&gt;
                &lt;dxai:ProofreadBehavior x:Name=&quot;Proofread&quot;/&gt;
            &lt;/dxmvvm:Interaction.Behaviors&gt;
        &lt;/dxe:TextEdit&gt;
    &lt;/Grid&gt;
&lt;/dx:ThemedWindow&gt;
</code></pre></section>

## Shorten

[ShortenBehavior](/WPF/DevExpress.AIIntegration.Wpf.ShortenBehavior) removes unnecessary details and makes content more concise.

The following example activates the AI-powered “Shorten” extension in a TextEdit control:

- XAML

<section id="tabpanel_qP1OBn1Dpl_tabid-xaml" role="tabpanel" data-tab="tabid-xaml">
<pre><code data-highlight-lines="[[6],[7],[13]]" class="lang-xaml">&lt;dx:ThemedWindow
    xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
    xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
    xmlns:dx=&quot;http://schemas.devexpress.com/winfx/2008/xaml/core&quot;
    xmlns:dxe=&quot;http://schemas.devexpress.com/winfx/2008/xaml/editors&quot;
    xmlns:dxmvvm=&quot;http://schemas.devexpress.com/winfx/2008/xaml/mvvm&quot; 
    xmlns:dxai=&quot;http://schemas.devexpress.com/winfx/2008/xaml/ai&quot;
    x:Class=&quot;AIAssistant.MainWindow&quot;
    Title=&quot;MainWindow&quot; Height=&quot;800&quot; Width=&quot;800&quot;&gt;
    &lt;Grid&gt;
        &lt;dxe:TextEdit TextWrapping=&quot;Wrap&quot; AcceptsReturn=&quot;True&quot; VerticalContentAlignment=&quot;Top&quot;&gt;
            &lt;dxmvvm:Interaction.Behaviors&gt;
                &lt;dxai:ShortenBehavior x:Name=&quot;Shorten&quot;/&gt;
            &lt;/dxmvvm:Interaction.Behaviors&gt;
        &lt;/dxe:TextEdit&gt;
    &lt;/Grid&gt;
&lt;/dx:ThemedWindow&gt;
</code></pre></section>

## Summarize

[SummarizeBehavior](/WPF/DevExpress.AIIntegration.Wpf.SummarizeBehavior) generates a brief summary of long text.

`SummarizeBehavior` supports the following summarization modes:

1. **Abstractive Summarization**

     Generates a summary by understanding the context of the original text and rephrasing it in a new, concise form. The AI essentially “writes” a new summary based on its understanding, which may include new sentences that were not present in the original text.
2. **Extractive Summarization**

     Selects and extracts key sentences or phrases from the original text. The AI identifies the most important parts of the content and combines them into a summary without altering the original wording.

The following example activates the AI-powered “Summarize” extension in a TextEdit control:

- XAML

<section id="tabpanel_-bUAoQMQGS_tabid-xaml" role="tabpanel" data-tab="tabid-xaml">
<pre><code data-highlight-lines="[[6],[7],[13]]" class="lang-xaml">&lt;dx:ThemedWindow
    xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
    xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
    xmlns:dx=&quot;http://schemas.devexpress.com/winfx/2008/xaml/core&quot;
    xmlns:dxe=&quot;http://schemas.devexpress.com/winfx/2008/xaml/editors&quot;
    xmlns:dxmvvm=&quot;http://schemas.devexpress.com/winfx/2008/xaml/mvvm&quot; 
    xmlns:dxai=&quot;http://schemas.devexpress.com/winfx/2008/xaml/ai&quot;
    x:Class=&quot;AIAssistant.MainWindow&quot;
    Title=&quot;MainWindow&quot; Height=&quot;800&quot; Width=&quot;800&quot;&gt;
    &lt;Grid&gt;
        &lt;dxe:TextEdit TextWrapping=&quot;Wrap&quot; AcceptsReturn=&quot;True&quot; VerticalContentAlignment=&quot;Top&quot;&gt;
            &lt;dxmvvm:Interaction.Behaviors&gt;
                &lt;dxai:SummarizeBehavior x:Name=&quot;Summarize&quot; SummarizationMode = &quot;Extractive&quot;/&gt;
            &lt;/dxmvvm:Interaction.Behaviors&gt;
        &lt;/dxe:TextEdit&gt;
    &lt;/Grid&gt;
&lt;/dx:ThemedWindow&gt;
</code></pre></section>

## Translate

[TranslateBehavior](/WPF/DevExpress.AIIntegration.Wpf.TranslateBehavior) converts the text from one language to another while maintaining the original meaning and context. Use the [Languages](/WPF/DevExpress.AIIntegration.Wpf.TranslateBehavior.Languages) parameter to specify target languages/cultures for text translation.

The following example activates the AI-powered “Translate” extension in a TextEdit control:

- XAML

<section id="tabpanel_dY9exEE0z3_tabid-xaml" role="tabpanel" data-tab="tabid-xaml">
<pre><code data-highlight-lines="[[6],[7],[13],[14],[15],[16]]" class="lang-xaml">&lt;dx:ThemedWindow
    xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
    xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
    xmlns:dx=&quot;http://schemas.devexpress.com/winfx/2008/xaml/core&quot;
    xmlns:dxe=&quot;http://schemas.devexpress.com/winfx/2008/xaml/editors&quot;
    xmlns:dxmvvm=&quot;http://schemas.devexpress.com/winfx/2008/xaml/mvvm&quot; 
    xmlns:dxai=&quot;http://schemas.devexpress.com/winfx/2008/xaml/ai&quot;
    x:Class=&quot;AIAssistant.MainWindow&quot;
    Title=&quot;MainWindow&quot; Height=&quot;800&quot; Width=&quot;800&quot;&gt;
    &lt;Grid&gt;
        &lt;dxe:TextEdit TextWrapping=&quot;Wrap&quot; AcceptsReturn=&quot;True&quot; VerticalContentAlignment=&quot;Top&quot;&gt;
            &lt;dxmvvm:Interaction.Behaviors&gt;
                &lt;dxai:TranslateBehavior x:Name=&quot;Translate&quot;&gt;
                    &lt;dxai:LanguageInfo Culture=&quot;de-DE&quot;/&gt;
                    &lt;dxai:LanguageInfo Culture=&quot;es-ES&quot;/&gt;
                &lt;/dxai:TranslateBehavior&gt;
            &lt;/dxmvvm:Interaction.Behaviors&gt;
        &lt;/dxe:TextEdit&gt;
    &lt;/Grid&gt;
&lt;/dx:ThemedWindow&gt;
</code></pre></section>

## Document Summarization

[DocumentSummarizeBehavior](/WPF/DevExpress.AIIntegration.Wpf.DocumentSummarizeBehavior) generates a brief summary of long text contained in a document.

`DocumentSummarizeBehavior` supports the following summarization modes:

- Abstractive Summarization

    Generates a summary by understanding the context of the original text and rephrasing it in a new, concise form. The AI essentially “writes” a new summary based on its understanding, which may include new sentences that were not present in the original text.
- Extractive Summarization

    Selects and extracts key sentences or phrases from the original text. The AI identifies the most important parts of the content and combines them into a summary without altering the original wording.

The following example activates the AI-powered “Summarize” extension in a Document Preview control:

- XAML

<section id="tabpanel_Dz3pguJ-vS_tabid-xaml" role="tabpanel" data-tab="tabid-xaml">
<pre><code class="lang-xaml">xmlns:dxp=&quot;http://schemas.devexpress.com/winfx/2008/xaml/printing&quot; 
xmlns:dxai=&quot;http://schemas.devexpress.com/winfx/2008/xaml/ai&quot; 
xmlns:dxmvvm=&quot;http://schemas.devexpress.com/winfx/2008/xaml/mvvm&quot;  
... 
&lt;dxp:DocumentPreviewControl Name=&quot;preview&quot;&gt; 
    &lt;dxmvvm:Interaction.Behaviors&gt; 
        &lt;dxai:DocumentSummarizeBehavior SummarizationMode=&quot;Abstractive&quot; /&gt; 
    &lt;/dxmvvm:Interaction.Behaviors&gt; 
&lt;/dxp:DocumentPreviewControl&gt; 
</code></pre></section>

Review the following help topic for more information on how to use this functionality in the WPF Document Preview: [Summarize and Translate Reports in the WPF Document Preview](/XtraReports/405263/ai-powered-functionality/desktop-reporting/summarize-translate-in-wpf-document-preview).

## Document Translation

[DocumentTranslateBehavior](/WPF/DevExpress.AIIntegration.Wpf.DocumentTranslateBehavior) converts the text contained in a document from one language to another while maintaining the original meaning and context.

Use the [Languages](/WPF/DevExpress.AIIntegration.Wpf.DocumentTranslateBehavior.Languages) property to specify target languages for text translation.

The following example activates the AI-powered “Translate” extension in a Document Preview control:

- XAML

<section id="tabpanel_5NRvcJX75D_tabid-xaml" role="tabpanel" data-tab="tabid-xaml">
<pre><code class="lang-xaml">xmlns:dxp=&quot;http://schemas.devexpress.com/winfx/2008/xaml/printing&quot; 
xmlns:dxai=&quot;http://schemas.devexpress.com/winfx/2008/xaml/ai&quot; 
xmlns:dxmvvm=&quot;http://schemas.devexpress.com/winfx/2008/xaml/mvvm&quot;  
... 
&lt;dxp:DocumentPreviewControl Name=&quot;preview&quot;&gt; 
    &lt;dxmvvm:Interaction.Behaviors&gt; 
        &lt;dxai:DocumentTranslateBehavior&gt; 
            &lt;dxai:LanguageInfo Culture=&quot;de-DE&quot;/&gt; 
            &lt;dxai:LanguageInfo Culture=&quot;es-ES&quot;/&gt; 
            &lt;dxai:LanguageInfo Culture=&quot;pt-BR&quot;/&gt; 
        &lt;/dxai:DocumentTranslateBehavior&gt; 
    &lt;/dxmvvm:Interaction.Behaviors&gt; 
&lt;/dxp:DocumentPreviewControl&gt; 
</code></pre></section>

Review the following help topic for more information on how to use this functionality in the WPF Document Preview: [Summarize and Translate Reports in the WPF Document Preview](/XtraReports/405263/ai-powered-functionality/desktop-reporting/summarize-translate-in-wpf-document-preview).

## Inline Document Translation

[DocumentTranslateInlineBehavior](/WPF/DevExpress.AIIntegration.Wpf.DocumentTranslateInlineBehavior) converts the text contained in a document from one language to another on the document preview. Unlike [DocumentTranslateBehavior](/WPF/DevExpress.AIIntegration.Wpf.DocumentTranslateBehavior) the **Translate Inline** command translates text directly on the document preview without additional dialogs. You can export or print the translated document.

The following example activates the AI-powered “Translate Inline” extension in a Document Preview control: 

- XAML

<section id="tabpanel_mi12hhrPG7_tabid-xaml" role="tabpanel" data-tab="tabid-xaml">
<pre><code class="lang-xaml">xmlns:dxp=&quot;http://schemas.devexpress.com/winfx/2008/xaml/printing&quot; 
xmlns:dxai=&quot;http://schemas.devexpress.com/winfx/2008/xaml/ai&quot; 
xmlns:dxmvvm=&quot;http://schemas.devexpress.com/winfx/2008/xaml/mvvm&quot;  
... 
&lt;dxp:DocumentPreviewControl Name=&quot;preview&quot;&gt; 
    &lt;dxmvvm:Interaction.Behaviors&gt; 
        &lt;dxai:DocumentTranslateInlineBehavior&gt;
            &lt;dxai:LanguageInfo Culture=&quot;de-DE&quot;/&gt; 
        &lt;/dxai:DocumentTranslateInlineBehavior&gt;
    &lt;/dxmvvm:Interaction.Behaviors&gt; 
&lt;/dxp:DocumentPreviewControl&gt; 
</code></pre></section>

Additionally, you can specify the following properties:

- [PromptAugmentation](/WPF/DevExpress.AIIntegration.Wpf.DocumentTranslateInlineBehavior.PromptAugmentation)

    - Specifies additional instructions that modify the prompt before processing.

- [Temperature](/WPF/DevExpress.AIIntegration.Wpf.DocumentTranslateInlineBehavior.Temperature)

    - Specifies the balance between creativity and consistency in AI responses.

Review the following help topic for more information on how to use this functionality in the WPF Document Preview: [Translate Reports Inline in the WPF Document Preview](/XtraReports/405609/ai-powered-functionality/desktop-reporting/document-translate-inline-wpf-viewer).

## Prompt Augmentation

DevExpress AI-powered extensions allow you to specify additional instructions that modify the default prompt before processing. Prompt augmentation improves the relevance and accuracy of the AI’s response. Use the [PromptAugmentation](/WPF/DevExpress.AIIntegration.Wpf.Internal.TextModificationBehavior.PromptAugmentation) property to specify additional instructions.

The following code snippet registers a [ChangeStyleBehavior](/WPF/DevExpress.AIIntegration.Wpf.ChangeStyleBehavior) and assigns it to a `TextEdit` control. It uses the AI-powered extension to change style of the original text and obtain the result in English, regardless of the language used in the original text:

- XAML

<section id="tabpanel_H3RLgGp0wB_tabid-xaml" role="tabpanel" data-tab="tabid-xaml">
<pre><code data-highlight-lines="[[14]]" class="lang-xaml">&lt;dx:ThemedWindow
    xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
    xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
    xmlns:dx=&quot;http://schemas.devexpress.com/winfx/2008/xaml/core&quot;
    xmlns:dxe=&quot;http://schemas.devexpress.com/winfx/2008/xaml/editors&quot;
    xmlns:dxmvvm=&quot;http://schemas.devexpress.com/winfx/2008/xaml/mvvm&quot; 
    xmlns:dxai=&quot;http://schemas.devexpress.com/winfx/2008/xaml/ai&quot;
    x:Class=&quot;AIAssistant.MainWindow&quot;
    Title=&quot;MainWindow&quot; Height=&quot;800&quot; Width=&quot;800&quot;&gt;
    &lt;Grid&gt;
        &lt;dxe:TextEdit TextWrapping=&quot;Wrap&quot; AcceptsReturn=&quot;True&quot; VerticalContentAlignment=&quot;Top&quot;&gt;
            &lt;dxmvvm:Interaction.Behaviors&gt;
                &lt;dxai:ChangeStyleBehavior x:Name=&quot;ChangeStyle&quot;
                                PromptAugmentation=&quot;Always translate the result into English.&quot;/&gt;
            &lt;/dxmvvm:Interaction.Behaviors&gt;
        &lt;/dxe:TextEdit&gt;
    &lt;/Grid&gt;
&lt;/dx:ThemedWindow&gt;
</code></pre></section>

## Ask AI Assistant (Custom Prompt)

[CustomRequestBehavior](/WPF/DevExpress.AIIntegration.Wpf.CustomRequestBehavior) displays the “Ask AI Assistant” item in the context menu. The “Ask AI Assistant” item invokes a dialog that allows users to interact with an AI-powered assistant directly within your application. A user can enter a question or prompt, and the AI assistant will process the query and generate an answer.

The user can insert the answer directly into a document or text field with a single click. The user can insert the answer above/below the cursor, replace all content or selected text, or copy the answer to the clipboard.

The following example activates the AI-powered “Ask” extension in a TextEdit control:

- XAML

<section id="tabpanel_319gpf+hDa_tabid-xaml" role="tabpanel" data-tab="tabid-xaml">
<pre><code data-highlight-lines="[[6],[7],[13]]" class="lang-xaml">&lt;dx:ThemedWindow
    xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
    xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
    xmlns:dx=&quot;http://schemas.devexpress.com/winfx/2008/xaml/core&quot;
    xmlns:dxe=&quot;http://schemas.devexpress.com/winfx/2008/xaml/editors&quot;
    xmlns:dxmvvm=&quot;http://schemas.devexpress.com/winfx/2008/xaml/mvvm&quot; 
    xmlns:dxai=&quot;http://schemas.devexpress.com/winfx/2008/xaml/ai&quot;
    x:Class=&quot;AIAssistant.MainWindow&quot;
    Title=&quot;MainWindow&quot; Height=&quot;800&quot; Width=&quot;800&quot;&gt;
    &lt;Grid&gt;
        &lt;dxe:TextEdit TextWrapping=&quot;Wrap&quot; AcceptsReturn=&quot;True&quot; VerticalContentAlignment=&quot;Top&quot;&gt;
            &lt;dxmvvm:Interaction.Behaviors&gt;
                &lt;dxai:CustomRequestBehavior x:Name=&quot;CustomRequest&quot;/&gt;
            &lt;/dxmvvm:Interaction.Behaviors&gt;
        &lt;/dxe:TextEdit&gt;
    &lt;/Grid&gt;
&lt;/dx:ThemedWindow&gt;
</code></pre></section>

## Chunking (Processing Long Input Text)

If input text is too long, the DevExpress control displays a dialog that informs a user that the input text must be divided into manageable chunks to ensure accurate processing.

To process chunks one by one, the user can click the “Proceed” button, or enable the “I consent to process all remaining chunks” option to process all chunks automatically.

After processing, chunks are reassembled into a single output.

Tip

Use the [ChunkMaxLength](/CoreLibraries/DevExpress.AIIntegration.AIIntegration.ChunkMaxLength) property to specify how much text can be processed at once. The chunk length is limited to 6,000 symbols. The [TextBufferMaxSize](/CoreLibraries/DevExpress.AIIntegration.AIIntegration.TextBufferMaxSize) property specifies the maximum size of the input text, in bytes.

See Also

[AI-powered Extensions for WPF](/WPF/405223/ai-powered-extensions)