Class RadChat
Represents a chat control that provides a comprehensive messaging interface with support for various message types, user interactions, overlays, and customizable appearance settings.
Inherited Members
Namespace: Telerik.WinControls.UI
Assembly: Telerik.WinControls.UI.dll
Syntax
[TelerikToolboxCategory("Data Controls")]
public class RadChat : RadControl, INotifyPropertyChanged, ISupportInitializeNotification, ISupportInitialize, IComponentTreeHandler, ILayoutHandler, IPCHost, IAnalyticsProvider
Constructors
RadChat()
Initializes a new instance of the RadChat class with default settings for messaging functionality.
Declaration
public RadChat()
Properties
Author
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.
Declaration
public Author Author { get; set; }
Property Value
Author
An Author instance representing the current user, or null if no author is set. |
See Also
AutoAddUserMessages
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.
Declaration
public bool AutoAddUserMessages { get; set; }
Property Value
System.Boolean
|
See Also
AvatarSize
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.
Declaration
public SizeF AvatarSize { get; set; }
Property Value
System.Drawing.SizeF
A System.Drawing.SizeF structure representing the width and height of avatar images. The default value is 28x28 pixels. |
See Also
ChatElement
Gets the main chat element that contains all messaging functionality, visual elements, and user interaction capabilities.
Declaration
public RadChatElement ChatElement { get; }
Property Value
RadChatElement
The RadChatElement instance that provides the core chat functionality. |
DefaultSize
Gets the default size for the chat control, providing appropriate dimensions for typical chat interface layouts.
Declaration
protected override Size DefaultSize { get; }
Property Value
System.Drawing.Size
A System.Drawing.Size structure representing the default width and height of 360x500 pixels. |
ShowAvatars
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.
Declaration
public bool ShowAvatars { get; set; }
Property Value
System.Boolean
|
See Also
ShowMessagesOnOneSide
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.
Declaration
public bool ShowMessagesOnOneSide { get; set; }
Property Value
System.Boolean
|
TimeSeparatorInterval
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.
Declaration
public TimeSpan TimeSeparatorInterval { get; set; }
Property Value
System.TimeSpan
A System.TimeSpan representing the minimum time difference between messages required to insert a time separator. If set to System.TimeSpan.Zero, no time separators will be added automatically. The default value is 24 hours. |
See Also
Methods
AddMessage(ChatMessage)
Adds a new message to the chat conversation, supporting various message types including text messages, suggested actions, media content, cards, and overlays.
Declaration
public void AddMessage(ChatMessage message)
Parameters
ChatMessage
message
The ChatMessage to be displayed in the chat conversation. Typical message types include ChatTextMessage, ChatSuggestedActionsMessage, ChatMediaMessage, ChatCardMessage, and ChatOverlayMessage. |
See Also
CreateChatElement()
Creates and returns a new instance of the chat element that provides the core messaging functionality for the control.
Declaration
protected virtual RadChatElement CreateChatElement()
Returns
RadChatElement
A new RadChatElement instance configured for chat operations. |
CreateChildItems(RadElement)
Creates child elements for the chat control, including the main chat element that handles messaging functionality.
Declaration
protected override void CreateChildItems(RadElement parent)
Parameters
RadElement
parent
The parent RadElement that will contain the child elements. |
Overrides
HideOverlay()
Hides any overlays that are currently displayed by the chat control, returning the interface to its normal messaging state.
Declaration
public virtual void HideOverlay()
See Also
OnGotFocus(EventArgs)
Handles the GotFocus event by automatically focusing the input text box, ensuring users can immediately start typing messages when the chat control receives focus.
Declaration
protected override void OnGotFocus(EventArgs e)
Parameters
System.EventArgs
e
An System.EventArgs that contains the event data. |
Overrides
OnMouseWheel(MouseEventArgs)
Handles mouse wheel events to provide smooth scrolling functionality within the chat messages area, automatically calculating and applying appropriate scroll values.
Declaration
protected override void OnMouseWheel(MouseEventArgs e)
Parameters
System.Windows.Forms.MouseEventArgs
e
A System.Windows.Forms.MouseEventArgs that contains the mouse wheel event data including delta values for scroll calculations. |
Overrides
ShowOverlay(ChatOverlayMessage)
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.
Declaration
public virtual void ShowOverlay(ChatOverlayMessage message)
Parameters
ChatOverlayMessage
message
The ChatOverlayMessage that contains the overlay information and configuration to be displayed. |
See Also
Events
CardActionClicked
Occurs when the user clicks on a card action element within a ChatCardMessage, enabling interactive card-based interfaces and rich content interactions.
Declaration
public event CardActionEventHandler CardActionClicked
Event Type
CardActionEventHandler
|
See Also
ItemFormatting
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.
Declaration
public event ChatItemElementEventHandler ItemFormatting
Event Type
ChatItemElementEventHandler
|
See Also
SendMessage
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.
Declaration
public event SendMessageEventHandler SendMessage
Event Type
SendMessageEventHandler
|
See Also
SuggestedActionClicked
Occurs when the user clicks on a suggested action element within a ChatSuggestedActionsMessage, providing quick response options and streamlined user interactions.
Declaration
public event SuggestedActionEventHandler SuggestedActionClicked
Event Type
SuggestedActionEventHandler
|
See Also
TimeSeparatorAdding
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.
Declaration
public event TimeSeparatorEventHandler TimeSeparatorAdding
Event Type
TimeSeparatorEventHandler
|
See Also
ToolbarActionClicked
Occurs when the user clicks on a toolbar action element, providing access to chat-level functionality and administrative operations.
Declaration
public event ToolbarActionEventHandler ToolbarActionClicked
Event Type
ToolbarActionEventHandler
|