Class
ChatMessage

Represents a base class for chat messages, providing common properties such as author, timestamp, and user-defined data, and supporting property change notification.

Definition

Namespace:Telerik.WinControls.UI

Assembly:Telerik.WinControls.UI.dll

Syntax:

cs-api-definition
public abstract class ChatMessage : INotifyPropertyChanged

Inheritance: objectChatMessage

Derived Classes: ChatCardMessageChatCarouselMessageChatMediaMessageChatOverlayMessageChatSuggestedActionsMessageChatTextMessageChatTimeSeparatorMessage

Implements: INotifyPropertyChanged

Constructors

ChatMessage(Author, DateTime, object)

Initializes a new instance of the ChatMessage class with the specified author, timestamp, and user data.

Declaration

cs-api-definition
public ChatMessage(Author author, DateTime timeStamp, object userData)

Parameters

author

Author

The author of the chat message. Represents the user who created the message.

timeStamp

DateTime

The date and time when the message was created.

userData

object

An object containing additional user-defined data associated with the message. Can be null if no extra data is needed.

Properties

Author

Gets or sets the author associated with this instance.

Declaration

cs-api-definition
public Author Author { get; set; }

Property Value

Author

IsEdited

Gets or sets a value indicating whether this message has been edited.

Declaration

cs-api-definition
public bool IsEdited { get; set; }

Property Value

bool

IsMultiReply

Gets a value indicating whether this message is a reply to more than one message.

Declaration

cs-api-definition
public bool IsMultiReply { get; }

Property Value

bool

IsReply

Gets a value indicating whether this message is a reply to one or more messages.

Declaration

cs-api-definition
public bool IsReply { get; }

Property Value

bool

ReplyToAuthor

Gets the author of the first this message replies to, or null when this is not a reply.

Declaration

cs-api-definition
public Author ReplyToAuthor { get; }

Property Value

Author

ReplyToAuthors

Gets the unique authors of all messages this message is replying to.

Declaration

cs-api-definition
public IEnumerable<Author> ReplyToAuthors { get; }

Property Value

IEnumerable<Author>

ReplyToMessage

Gets or sets the message this message is replying to. When set, replaces any existing entries in ReplyToMessages. Returns the first entry when getting.

Declaration

cs-api-definition
public ChatMessage ReplyToMessage { get; set; }

Property Value

ChatMessage

ReplyToMessagePreview

Gets a preview text of the reply message(truncated if necessary). For multi-reply, returns a combined preview.

Declaration

cs-api-definition
public string ReplyToMessagePreview { get; }

Property Value

string

ReplyToMessages

Gets the list of messages that this message is replying to. Add or remove items to control whether this message renders reply bubbles.

Declaration

cs-api-definition
public IList<ChatMessage> ReplyToMessages { get; }

Property Value

IList<ChatMessage>

ReplyToMessagesCount

Gets the count of messages this message is replying to.

Declaration

cs-api-definition
public int ReplyToMessagesCount { get; }

Property Value

int

TimeStamp

Gets or sets the date and time associated with this instance.

Declaration

cs-api-definition
public DateTime TimeStamp { get; set; }

Property Value

DateTime

UserData

Gets or sets a user-defined object that contains custom data associated with this instance.

Declaration

cs-api-definition
public object UserData { get; set; }

Property Value

object

Remarks

This property can be used to attach any additional information to the object at runtime. The value can be of any type, or null if no user data is associated.

Methods

OnPropertyChanged(string)

Raises the PropertyChanged event to notify listeners that a property value has changed.

Declaration

cs-api-definition
protected virtual void OnPropertyChanged(string propertyName)

Parameters

propertyName

string

The name of the property that changed. This value is passed to event handlers to identify the property that was updated.

Remarks

Override this method in a derived class to provide custom logic when a property value changes. This method is typically called by property setters to implement the INotifyPropertyChanged pattern.

Events

PropertyChanged

Occurs when a property value changes.

Declaration

cs-api-definition
public event PropertyChangedEventHandler PropertyChanged

Event Value

PropertyChangedEventHandler

Implements INotifyPropertyChanged.PropertyChanged

Remarks

This event is typically raised by classes that implement the INotifyPropertyChanged interface to notify clients, such as data-binding frameworks, that a property value has changed. Handlers attached to this event receive the name of the property that changed in the PropertyChangedEventArgs parameter.