Back to Devexpress

ReportPromptToReportBehaviorProperties.PredefinedPrompts Property

xtrareports-devexpress-dot-aiintegration-dot-winforms-dot-reporting-dot-reportprompttoreportbehaviorproperties.md

latest6.0 KB
Original Source

ReportPromptToReportBehaviorProperties.PredefinedPrompts Property

Specifies predefined prompts that can be used to create a report in the Report Wizard.

Namespace : DevExpress.AIIntegration.WinForms.Reporting

Assembly : DevExpress.AIIntegration.WinForms.Reporting.v25.2.dll

NuGet Package : DevExpress.AIIntegration.WinForms.Reporting

Declaration

csharp
[DXCategory("Behavior")]
public IEnumerable<AIReportPrompt> PredefinedPrompts { get; set; }
vb
<DXCategory("Behavior")>
Public Property PredefinedPrompts As IEnumerable(Of AIReportPrompt)

Property Value

TypeDescription
IEnumerable<AIReportPrompt>

A prompt collection.

|

Remarks

Use ReportPromptToReportBehaviorProperties.PredefinedPrompts property to display prompts in the Report Wizard.

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 property.

csharp
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";
    // ...
    }
}
vb
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:

Review the following help topic for more information on how to create and manage prompts: Prompt to Report Behavior in the WinForms Report Designer (CTP).

See Also

ReportPromptToReportBehaviorProperties Class

ReportPromptToReportBehaviorProperties Members

DevExpress.AIIntegration.WinForms.Reporting Namespace