AIChatControl.ContentFormat Property
Gets or sets the format of AI responses (PlainText or Markdown).
Namespace: DevExpress.AIIntegration.WinForms.Chat
Assembly: DevExpress.AIIntegration.WinForms.Chat.v26.1.dll
NuGet Package: DevExpress.AIIntegration.WinForms.Chat
Declaration
[DefaultValue(ResponseContentFormat.PlainText)]
public ResponseContentFormat ContentFormat { get; set; }
Property Value
| Type | Default | Description |
|---|---|---|
| ResponseContentFormat | PlainText | A |
Available values:
| Name | Description |
|---|---|
| Markdown | An assistant sends the response as Markdown. |
| PlainText | An assistant sends the response as plain text. |
Remarks
To enable Markdown message rendering:
- Set the
ContentFormatproperty toMarkdownto receive responses as Markdown. - Handle the MarkdownConvert event to convert Markdown text into HTML and make responses more readable, structured, and visually appealing.
Warning
Always sanitize AI-generated content before rendering it in the UI.
Example
The following example enables Markdown message rendering. The example uses the Markdig Markdown processing library to convert Markdown text into HTML.
using DevExpress.AIIntegration.Blazor.Chat;
using DevExpress.AIIntegration.Blazor.Chat.WebView;
using Ganss.Xss;
using Markdig;
HtmlSanitizer sanitizer;
public Chat() {
InitializeComponent();
sanitizer = new HtmlSanitizer();
aiChatControl1.ContentFormat = ResponseContentFormat.Markdown;
aiChatControl1.MarkdownConvert += AiChatControl1_MarkdownConvert;
}
void AiChatControl1_MarkdownConvert(object sender, AIChatControlMarkdownConvertEventArgs e) {
// Convert Markdown to HTML.
string html = Markdown.ToHtml(e.MarkdownText);
// WARNING: The AI agent's content may be untrusted.
// Developers must sanitize all HTML before rendering to prevent XSS attacks.
string safeHtml = sanitizer.Sanitize(html);
// Assign sanitized HTML for rendering.
e.HtmlText = (MarkupString)safeHtml;
}
The following screenshot demonstrates the result:

Refer to the following help topic for additional information: AI Chat Control