xtrareports-devexpress-dot-aiintegration-dot-reporting-314c41d7.md
A collection of predefined prompts displayed in the Report Wizard.
Namespace : DevExpress.AIIntegration.Reporting
Assembly : DevExpress.AIIntegration.Reporting.Common.v25.2.dll
NuGet Package : DevExpress.AIIntegration.Reporting.Common
public class AIReportPromptCollection :
List<AIReportPrompt>
Public Class AIReportPromptCollection
Inherits List(Of AIReportPrompt)
The following members return AIReportPromptCollection objects:
Multiple built-in DevExpress prompt suggestions ship with the AI-powered Prompt-to-Report (CTP) functionality. You can review them to create your own prompts. For example, check the “Prompt Template” entry - a basic template you can customize. You can set up page layout, styles, fields, and functions. Other templates describe common report types, like invoices. These prompts are stored in AIReportPromptCollection and automatically appear in the Report Wizard after registering a WinForms.Reporting.ReportPromptToReportBehavior or Wpf.Reporting.ReportPromptToReportBehavior.
To change built-in DevExpress prompts, call the AIReportPromptCollection.GetDefaultReportPrompts() method and access the prompt. Modify prompt Text and Title.
using DevExpress.AIIntegration.WinForms.Reporting;
// ...
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
behaviorManager1.Attach<ReportPromptToReportBehavior>(reportDesigner1, behavior => {
var collection = AIReportPromptCollection.GetDefaultReportPrompts();
collection[0].Text = "your custom text";
behavior.Properties.PredefinedPrompts = collection;
});
}
}
Imports DevExpress.AIIntegration.WinForms.Reporting
' ...
Partial Public Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
behaviorManager1.Attach(Of ReportPromptToReportBehavior)(reportDesigner1, Sub(behavior)
Dim collection = AIReportPromptCollection.GetDefaultReportPrompts()
collection(0).Text = "your custom text"
behavior.Properties.PredefinedPrompts = collection
End Sub)
End Sub
End Class
Code-Behind:
using DevExpress.AIIntegration.Wpf.Reporting;
using DevExpress.Mvvm.UI.Interactivity;
public partial class MainWindow : Window {
public MainWindow() {
InitializeComponent();
ReportPromptToReportBehavior reportBehavior = new ReportPromptToReportBehavior();
var collection = AIReportPromptCollection.GetDefaultReportPrompts();
collection[0].Title = "My Changed Prompt";
reportBehavior.PredefinedPrompts = collection;
Interaction.GetBehaviors(designer).Add(reportBehavior);
}
}
Imports DevExpress.AIIntegration.Wpf.Reporting
Imports DevExpress.Mvvm.UI.Interactivity
Partial Public Class MainWindow
Inherits Window
Public Sub New()
InitializeComponent()
Dim reportBehavior As New ReportPromptToReportBehavior()
Dim collection = AIReportPromptCollection.GetDefaultReportPrompts()
collection(0).Title = "My Changed Prompt"
reportBehavior.PredefinedPrompts = collection
Interaction.GetBehaviors(designer).Add(reportBehavior)
End Sub
End Class
The following code snippet obtains built-in DevExpress prompts from AIReportPromptCollection, creates a custom prompt (an AIReportPrompt object), and adds this prompt to the collection. The collection is assigned to the ReportPromptToReportBehaviorProperties.PredefinedPrompts or ReportPromptToReportBehavior.PredefinedPrompts property.
using DevExpress.AIIntegration.WinForms.Reporting;
// ...
public partial class Form1 : Form {
public Form1() {
behaviorManager1.Attach<ReportPromptToReportBehavior>(reportDesigner1, behavior => {
// Obtain built-in DevExpress prompts from the collection.
var collection = AIReportPromptCollection.GetDefaultReportPrompts();
// Create a custom prompt.
AIReportPrompt customPrompt = new AIReportPrompt();
customPrompt.Title = "Custom Prompt";
customPrompt.Text = Prompts.CustomAIReportPrompt;
// Add this prompt to the collection.
collection.Add(customPrompt);
// Display Prompts in the Report Wizard.
behavior.Properties.PredefinedPrompts = collection;
});
}
public static class Prompts {
public const string CustomAIReportPrompt = "Create Sample Report:\r\n \r\nPage Setup:\r\n- Paper Size: A4\r\n- Report Margins:\r\n - Top & Bottom: 40\r\n - Left & Right: 60\r\n\r\nReport Header:\r\n- Title: Sample Report\r\n- Alignment: Center\r\n- Font: Comic Sans MS, 12pt, Bold\r\n\r\nCreate a horizontal table with the four column headers that correspond to fields in the bound data source.\r\n\r\nFont for column headers: Comic Sans MS, 12pt, Bold\r\n \r\nDetail Section:\r\nBind data cells to the fields corresponding to the column headers defined in the Group Header\r\nFont for data cells: Comic Sans MS, 12pt, Bold\r\n \r\nSummary Section:\r\nInclude calculated values for bound fields.\r\nSummary type: [Sum]\r\nFont for summary values: Comic Sans MS, 12pt, Bold";
// ...
}
}
Imports DevExpress.AIIntegration.WinForms.Reporting
' ...
Partial Public Class Form1
Inherits Form
Public Sub New()
behaviorManager1.Attach(Of ReportPromptToReportBehavior)(reportDesigner1, Sub(behavior)
' Obtain built-in DevExpress prompts from the collection.
Dim collection = AIReportPromptCollection.GetDefaultReportPrompts()
' Create a custom prompt.
Dim customPrompt As New AIReportPrompt()
customPrompt.Title = "Custom Prompt"
customPrompt.Text = Prompts.CustomAIReportPrompt
' Add this prompt to the collection.
collection.Add(customPrompt)
' Display Prompts in the Report Wizard.
behavior.Properties.PredefinedPrompts = collection
End Sub)
End Sub
Public Module Prompts
Public Const CustomAIReportPrompt As String = "Create Sample Report:" & vbCrLf & " " & vbCrLf & "Page Setup:" & vbCrLf & "- Paper Size: A4" & vbCrLf & "- Report Margins:" & vbCrLf & " - Top & Bottom: 40" & vbCrLf & " - Left & Right: 60" & vbCrLf & vbCrLf & "Report Header:" & vbCrLf & "- Title: Sample Report" & vbCrLf & "- Alignment: Center" & vbCrLf & "- Font: Comic Sans MS, 12pt, Bold" & vbCrLf & vbCrLf & "Create a horizontal table with the four column headers that correspond to fields in the bound data source." & vbCrLf & vbCrLf & "Font for column headers: Comic Sans MS, 12pt, Bold" & vbCrLf & " " & vbCrLf & "Detail Section:" & vbCrLf & "Bind data cells to the fields corresponding to the column headers defined in the Group Header" & vbCrLf & "Font for data cells: Comic Sans MS, 12pt, Bold" & vbCrLf & " " & vbCrLf & "Summary Section:" & vbCrLf & "Include calculated values for bound fields." & vbCrLf & "Summary type: [Sum]" & vbCrLf & "Font for summary values: Comic Sans MS, 12pt, Bold"
' ...
End Module
End Class
The following image illustrates the result:
Markup:
xmlns:dxrud="http://schemas.devexpress.com/winfx/2008/xaml/reports/userdesigner"
xmlns:dxai="http://schemas.devexpress.com/winfx/2008/xaml/ai"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:reporting="clr-namespace:DevExpress.AIIntegration.Reporting;assembly=DevExpress.AIIntegration.Reporting.Common.v25.2"
...
<dxrud:ReportDesigner x:Name="designer">
<dxmvvm:Interaction.Behaviors>
<dxai:ReportPromptToReportBehavior FixLayoutErrors="true">
<dxai:ReportPromptToReportBehavior.PredefinedPrompts>
<reporting:AIReportPrompt Title="Custom Prompt" Text="{x:Static local:Prompts.CustomAIReportPrompt}" />
</dxai:ReportPromptToReportBehavior.PredefinedPrompts>
</dxai:ReportPromptToReportBehavior>
</dxmvvm:Interaction.Behaviors>
</dxrud:ReportDesigner>
Code-Behind:
using DevExpress.AIIntegration.Wpf.Reporting;
using DevExpress.Mvvm.UI.Interactivity;
using DevExpress.AIIntegration.Reporting;
public partial class MainWindow : Window {
public MainWindow() {
InitializeComponent();
ReportPromptToReportBehavior reportBehavior = new ReportPromptToReportBehavior();
reportBehavior.FixLayoutErrors = true;
// Obtain built-in DevExpress prompts from the collection.
var collection = AIReportPromptCollection.GetDefaultReportPrompts();
// Create a custom prompt.
AIReportPrompt customPrompt = new AIReportPrompt();
customPrompt.Title = "Custom Prompt";
customPrompt.Text = Prompts.CustomAIReportPrompt;
// Add this prompt to the collection.
collection.Add(customPrompt);
// Display Prompts in the Report Wizard.
reportBehavior.PredefinedPrompts = collection;
Interaction.GetBehaviors(designer).Add(reportBehavior);
}
public static class Prompts {
public const string CustomAIReportPrompt = "Create Sample Report:\r\n \r\nPage Setup:\r\n- Paper Size: A4\r\n- Report Margins:\r\n - Top & Bottom: 40\r\n - Left & Right: 60\r\n\r\nReport Header:\r\n- Title: Sample Report\r\n- Alignment: Center\r\n- Font: Comic Sans MS, 12pt, Bold\r\n\r\nCreate a horizontal table with the four column headers that correspond to fields in the bound data source.\r\n\r\nFont for column headers: Comic Sans MS, 12pt, Bold\r\n \r\nDetail Section:\r\nBind data cells to the fields corresponding to the column headers defined in the Group Header\r\nFont for data cells: Comic Sans MS, 12pt, Bold\r\n \r\nSummary Section:\r\nInclude calculated values for bound fields.\r\nSummary type: [Sum]\r\nFont for summary values: Comic Sans MS, 12pt, Bold";
// ...
}
}
Imports DevExpress.AIIntegration.Wpf.Reporting
Imports DevExpress.Mvvm.UI.Interactivity
Imports DevExpress.AIIntegration.Reporting
Partial Public Class MainWindow
Inherits Window
Public Sub New()
InitializeComponent()
Dim reportBehavior As New ReportPromptToReportBehavior()
reportBehavior.FixLayoutErrors = True
' Obtain built-in DevExpress prompts from the collection.
Dim collection = AIReportPromptCollection.GetDefaultReportPrompts()
' Create a custom prompt.
Dim customPrompt As New AIReportPrompt()
customPrompt.Title = "Custom Prompt"
customPrompt.Text = Prompts.CustomAIReportPrompt
' Add this prompt to the collection.
collection.Add(customPrompt)
' Display Prompts in the Report Wizard.
reportBehavior.PredefinedPrompts = collection
Interaction.GetBehaviors(designer).Add(reportBehavior)
End Sub
Public NotInheritable Class Prompts
Private Sub New()
End Sub
Public Const CustomAIReportPrompt As String = "Create Sample Report:" & vbCrLf & " " & vbCrLf & "Page Setup:" & vbCrLf & "- Paper Size: A4" & vbCrLf & "- Report Margins:" & vbCrLf & " - Top & Bottom: 40" & vbCrLf & " - Left & Right: 60" & vbCrLf & vbCrLf & "Report Header:" & vbCrLf & "- Title: Sample Report" & vbCrLf & "- Alignment: Center" & vbCrLf & "- Font: Comic Sans MS, 12pt, Bold" & vbCrLf & vbCrLf & "Create a horizontal table with the four column headers that correspond to fields in the bound data source." & vbCrLf & vbCrLf & "Font for column headers: Comic Sans MS, 12pt, Bold" & vbCrLf & " " & vbCrLf & "Detail Section:" & vbCrLf & "Bind data cells to the fields corresponding to the column headers defined in the Group Header" & vbCrLf & "Font for data cells: Comic Sans MS, 12pt, Bold" & vbCrLf & " " & vbCrLf & "Summary Section:" & vbCrLf & "Include calculated values for bound fields." & vbCrLf & "Summary type: [Sum]" & vbCrLf & "Font for summary values: Comic Sans MS, 12pt, Bold"
' ...
End Class
End Class
After you add a custom prompt to the collection, it appears in the Report Wizard:
Object List<AIReportPrompt> AIReportPromptCollection
See Also