Views Overview
The AIPrompt component provides three predefined views and also lets you create custom views. Only one of these views is displayed at a time, and the user can switch the views via the TabView headers at the top.
The available built-in views are:
The Views is part of Telerik UI for .NET MAUI, the most comprehensive UI suite for .NET MAUI! To try it out, sign up for a free 30-day trial and kickstart your cross-platform app development today.
- Input View—Displays the input area of the AIPrompt.
- Output View—Displays the output area of the AIPrompt.
- Commands View—Displays a list of custom AIPrompt commands.
Define the Views
You can use two approaches for defining the views depending on the AutoGenerateViews
property.
-
AutoGenerateViews
(bool
)—Indicates whether the AIPrompt views will be auto-generated. Its default value isTrue
.
Automatic Views Generation
By default, the .NET MAUI AIPrompt component will always render both the Input and the Output views. The Commands view will be rendered only if you pass a custom set of commands through the Commands
property.
Manual Views Generation
To manually define the views, set AutoGenerateViews
to False
and add the views to the AIPrompt control:
Here is a sample ViewModel
class used in the example:
Common Properties
Each view that is supported by the AIPrompt extends the AIPromptView
class. This class exposes the following properties that you can set for each view:
-
ControlTemplate
(ControlTemplate
)—Sets the template that defines the visual appearance of the view. -
HeaderText
(string
)—Defines the text that resides in the TabView Header for switching the views. -
HeaderImageSource
(ImageSource
)—Defines the image source that resides in the TabView Header for switching the views.