RadChat
Represents a chat control that provides a comprehensive messaging interface with support for various message types, user interactions, overlays, and customizable appearance settings.
Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.UI.dll
Syntax:
[TelerikToolboxCategory("Data Controls")]
[Docking(DockingBehavior.Ask)]
public class RadChat : RadControl, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable, INotifyPropertyChanged, ISupportInitializeNotification, ISupportInitialize, IComponentTreeHandler, ILayoutHandler, IAnalyticsProvider
Inheritance: objectMarshalByRefObjectComponentControlScrollableControlRadControlRadChat...
Implements:
Inherited Members
Constructors
Properties
Gets or sets the current author that represents the primary user of the chat interface, used for message attribution, alignment, styling, and automatic message creation when AutoAddUserMessages is enabled.
public Author Author { get; set; }
An Author instance representing the current user, or null if no author is set.
Gets or sets a value indicating whether messages typed by the user in the input text box will automatically be added as ChatTextMessage instances to the chat conversation.
public bool AutoAddUserMessages { get; set; }
true if user messages are automatically added to the chat; otherwise, false. The default value is true.
Gets or sets the size of the avatar images displayed next to messages in the chat interface, controlling the visual dimensions of user profile pictures.
public SizeF AvatarSize { get; set; }
A SizeF structure representing the width and height of avatar images. The default value is 28x28 pixels.
Gets the main chat element that contains all messaging functionality, visual elements, and user interaction capabilities.
public RadChatElement ChatElement { get; }
The RadChatElement instance that provides the core chat functionality.
Gets the default size for the chat control, providing appropriate dimensions for typical chat interface layouts.
protected override Size DefaultSize { get; }
A Size structure representing the default width and height of 360x500 pixels.
Overrides:
Gets or sets a value indicating whether the reply functionality is enabled.
When disabled, the Reply button and the reply context-menu item are hidden and
programmatic StartReply calls are ignored.
public bool EnableReplies { get; set; }
Gets or sets a value indicating whether the hosted prompt input displays its more-actions button.
public bool IsMoreButtonVisible { get; set; }
Gets or sets a value indicating whether the hosted prompt input displays its speech-to-text button.
public bool IsSpeechToTextButtonVisible { get; set; }
Gets or sets the maximum number of visible attachment rows shown by the hosted prompt input before its attachment area becomes scrollable.
public int MaxVisibleAttachments { get; set; }
Gets or sets a value indicating whether avatar images will be displayed in the chat window next to messages, providing visual identification of message authors.
public bool ShowAvatars { get; set; }
true if avatar images are displayed next to messages; otherwise, false. The default value is true.
Gets or sets a value indicating whether messages will be displayed aligned to only one side of the chat window or distributed on both sides based on the message author, affecting the overall conversation layout and visual flow.
public bool ShowMessagesOnOneSide { get; set; }
true if all messages are aligned to one side regardless of author; false if messages are aligned based on their authors. The default value is false.
Gets or sets the time interval between messages that will trigger the automatic addition of a time separator element to visually group messages by time periods in the conversation.
Methods
Adds a new message to the chat conversation, supporting various message types including text messages, suggested actions, media content, cards, and overlays.
public void AddMessage(ChatMessage message)
The ChatMessage to be displayed in the chat conversation. Typical message types include ChatTextMessage, ChatSuggestedActionsMessage, ChatMediaMessage, ChatCardMessage, and ChatOverlayMessage.
Creates and returns a new instance of the chat element that provides the core messaging functionality for the control.
protected virtual RadChatElement CreateChatElement()
A new RadChatElement instance configured for chat operations.
Creates child elements for the chat control, including the main chat element that handles messaging functionality.
protected override void CreateChildItems(RadElement parent)
The parent RadElement that will contain the child elements.
Overrides:
Hides any overlays that are currently displayed by the chat control, returning the interface to its normal messaging state.
public virtual void HideOverlay()
Handles mouse wheel events to provide smooth scrolling functionality within the chat messages area, automatically calculating and applying appropriate scroll values.
protected override void OnMouseWheel(MouseEventArgs e)
A MouseEventArgs that contains the mouse wheel event data including delta values for scroll calculations.
Overrides:
Displays the specified overlay message in the chat control, providing a modal-like interface for user interactions such as confirmations, prompts, or custom input forms.
public virtual void ShowOverlay(ChatOverlayMessage message)
The ChatOverlayMessage that contains the overlay information and configuration to be displayed.
Events
Occurs after the prompt input attached files collection changes (file added or removed, from the built-in dialog or programmatically). Use this event to react to the end user attaching or detaching files in the chat input. Forwarded from AttachedFilesChanged.
public event EventHandler AttachedFilesChanged
Occurs when the user invokes an attachment action (Download, Download All, or Share) on a chat message.
Set Handled to true in the handler to suppress the default
behavior (such as the built-in Save File dialog) and provide custom handling instead.
public event EventHandler<AttachmentActionEventArgs> AttachmentActionRequested
Occurs when the user clicks on a card action element within a ChatCardMessage, enabling interactive card-based interfaces and rich content interactions.
public event CardActionEventHandler CardActionClicked
Occurs when the data item of a visual element is changed and the element is prepared for visualization, allowing customization of message appearance, styling, and layout properties.
public event ChatItemElementEventHandler ItemFormatting
Occurs when the user performs a message-sending action such as pressing the Enter key, clicking the Send message button, clicking on a suggested action, clicking on a card action, or confirming an overlay interaction.
public event SendMessageEventHandler SendMessage
Occurs when the user clicks on a suggested action element within a ChatSuggestedActionsMessage, providing quick response options and streamlined user interactions.
public event SuggestedActionEventHandler SuggestedActionClicked
Occurs after a new message is added to the chat but before it is displayed, allowing customization of whether a time separator should be inserted before the currently added message based on timing and context.
public event TimeSeparatorEventHandler TimeSeparatorAdding
Occurs when the user clicks on a toolbar action element, providing access to chat-level functionality and administrative operations.
public event ToolbarActionEventHandler ToolbarActionClicked