Class SfAIAssistView
A user interface control that can create modern conversational chatbot experiences in mobile applications. It is a flexible control that shows a conversation between two or more users in a fully customizable layout.
Inheritance
Namespace: Syncfusion.UI.Xaml.Chat
Assembly: Syncfusion.Chat.WinUI.dll
Syntax
public class SfAIAssistView : Control
Constructors
SfAIAssistView()
Initializes a new instance of the SfAIAssistView class.
Declaration
public SfAIAssistView()
Fields
BannerTemplateProperty
Identifies the BannerTemplate dependency property."/>
Declaration
public static readonly DependencyProperty BannerTemplateProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
CurrentUserProperty
Identifies the CurrentUser dependency property.
Declaration
public static readonly DependencyProperty CurrentUserProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
EditTemplateSelectorProperty
Identifies the EditTemplateSelector dependency property.
Declaration
public static readonly DependencyProperty EditTemplateSelectorProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
EnableStopRespondingProperty
Identifies the EnableStopResponding dependency property.
Declaration
public static readonly DependencyProperty EnableStopRespondingProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
MessagesProperty
Identifies the Messages dependency property.
Declaration
public static readonly DependencyProperty MessagesProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
ShowTypingIndicatorProperty
Identifies the ShowTypingIndicator dependency property.
Declaration
public static readonly DependencyProperty ShowTypingIndicatorProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
StopRespondingCommandProperty
Identifies the StopRespondingCommand dependency property.
Declaration
public static readonly DependencyProperty StopRespondingCommandProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
StopRespondingTemplateProperty
Identifies the StopRespondingTemplate dependency property.
Declaration
public static readonly DependencyProperty StopRespondingTemplateProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
SuggestionsProperty
Identifies the Suggestions dependency property.
Declaration
public static readonly DependencyProperty SuggestionsProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
TypingIndicatorProperty
Identifies the TypingIndicator dependency property.
Declaration
public static readonly DependencyProperty TypingIndicatorProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
ViewTemplateSelectorProperty
Gets or sets the template selector for the view mode.
Declaration
public static readonly DependencyProperty ViewTemplateSelectorProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Properties
BannerTemplate
Gets or sets the template for the banner content in the chat control.
Declaration
public DataTemplate BannerTemplate { get; set; }
Property Value
Type |
---|
Microsoft.UI.Xaml.DataTemplate |
CurrentUser
Gets or sets the current author of a message.
Declaration
public Author CurrentUser { get; set; }
Property Value
Type |
---|
Author |
EditTemplateSelector
Gets or sets the template selector for the edit mode.
Declaration
public DataTemplateSelector EditTemplateSelector { get; set; }
Property Value
Type |
---|
Microsoft.UI.Xaml.Controls.DataTemplateSelector |
EnableStopResponding
Gets or sets a value indicating whether the "Stop Responding" option is enabled or disabled.
Declaration
public bool EnableStopResponding { get; set; }
Property Value
Type |
---|
System.Boolean |
Remarks
When set to true
, users can manually stop the AI response using the stop responding button.
When set to false
, the option is disabled, preventing users from interrupting the response.
The default value is false
.
Examples
<syncfusion:SfAIAssistView EnableStopResponding="True"/>
Messages
Gets or sets the collection of messages to be displayed in the chat.
Declaration
public object Messages { get; set; }
Property Value
Type |
---|
System.Object |
ShowTypingIndicator
Gets or sets a value indicating whether the typing indicator should be displayed at the bottom of the chat control to notify when a user is typing.
Declaration
public bool ShowTypingIndicator { get; set; }
Property Value
Type |
---|
System.Boolean |
StopRespondingCommand
Gets or sets the command to be executed when the Stop Responding view is clicked.
Declaration
public ICommand StopRespondingCommand { get; set; }
Property Value
Type |
---|
System.Windows.Input.ICommand |
Remarks
This command allows handling user interactions when they choose to stop an ongoing response. It can be bound to a command in the ViewModel to execute specific logic.
Examples
<syncfusion:SfAIAssistView StopRespondingCommand="{Binding StopCommand}" />
StopRespondingTemplate
Gets or sets the template used to define the Stop Responding view of the SfAIAssistView.
Declaration
public DataTemplate StopRespondingTemplate { get; set; }
Property Value
Type |
---|
Microsoft.UI.Xaml.DataTemplate |
Remarks
This property allows customization of the appearance and layout of the Stop Responding view. The provided Microsoft.UI.Xaml.DataTemplate can include UI elements such as buttons, icons, or messages.
Examples
<syncfusion:SfAIAssistView>
<syncfusion:SfAIAssistView.StopRespondingTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Stopping..." />
</StackPanel>
</DataTemplate>
</syncfusion:SfAIAssistView.StopRespondingTemplate>
</syncfusion:SfAIAssistView>
Suggestions
Gets or sets the list of items to be displayed as a response to a user message. The suggestions will be displayed above the message typing/input area as part of the footer view.
Declaration
public IEnumerable<string> Suggestions { get; set; }
Property Value
Type |
---|
System.Collections.Generic.IEnumerable<System.String> |
TypingIndicator
Gets or sets the helper to set the settings for the typing indicator.
Declaration
public TypingIndicator TypingIndicator { get; set; }
Property Value
Type |
---|
TypingIndicator |
ViewTemplateSelector
Gets or sets the template selector for the view mode.
Declaration
public DataTemplateSelector ViewTemplateSelector { get; set; }
Property Value
Type |
---|
Microsoft.UI.Xaml.Controls.DataTemplateSelector |
Methods
OnApplyTemplate()
Declaration
protected override void OnApplyTemplate()
Events
MenuItemClicked
Occurs when a menu item is clicked in the SfAIAssistView control.
Declaration
public event EventHandler<MenuItemClickedEventArgs> MenuItemClicked
Event Type
Type |
---|
System.EventHandler<MenuItemClickedEventArgs> |
StopResponding
Occurs when the stop responding view is clicked.
Declaration
public event EventHandler<EventArgs> StopResponding
Event Type
Type |
---|
System.EventHandler<System.EventArgs> |
Remarks
This event is triggered when the user interacts with the stop responding view to cancel an ongoing AI response.
Examples
SfAIAssistView aiAssistView = new SfAIAssistView();
aiAssistView.StopResponding += AiAssistView_StopResponding;
private void AiAssistView_StopResponding(object sender, EventArgs e)
{
// Handle AI response cancellation logic
MessageBox.Show("AI response has been stopped.");
}
SuggestionSelected
Occurs when the suggestion item is selected in the SfAIAssistView control.
Declaration
public event EventHandler<SuggestionClickedEventArgs> SuggestionSelected
Event Type
Type |
---|
System.EventHandler<SuggestionClickedEventArgs> |