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:
public abstract class ChatMessage : INotifyPropertyChanged
Inheritance: objectChatMessage
Derived Classes:
Implements:
Constructors
Initializes a new instance of the ChatMessage class with the specified author, timestamp, and user data.
public ChatMessage(Author author, DateTime timeStamp, object userData)
The author of the chat message. Represents the user who created the message.
timeStampDateTimeThe date and time when the message was created.
userDataobjectAn object containing additional user-defined data associated with the message. Can be null if no extra data is needed.
Properties
Gets or sets the author associated with this instance.
public Author Author { get; set; }
Gets or sets a value indicating whether this message has been edited.
public bool IsEdited { get; set; }
Gets a value indicating whether this message is a reply to more than one message.
public bool IsMultiReply { get; }
Gets a value indicating whether this message is a reply to one or more messages.
public bool IsReply { get; }
Gets the author of the first this message replies to, or null when this is not a reply.
public Author ReplyToAuthor { get; }
ReplyToAuthors
IEnumerable<Author>
Gets the unique authors of all messages this message is replying to.
public IEnumerable<Author> ReplyToAuthors { get; }
Gets or sets the message this message is replying to. When set, replaces any existing entries in ReplyToMessages. Returns the first entry when getting.
public ChatMessage ReplyToMessage { get; set; }
Gets a preview text of the reply message(truncated if necessary). For multi-reply, returns a combined preview.
public string ReplyToMessagePreview { get; }
ReplyToMessages
IList<ChatMessage>
Gets the list of messages that this message is replying to. Add or remove items to control whether this message renders reply bubbles.
public IList<ChatMessage> ReplyToMessages { get; }
Gets the count of messages this message is replying to.
public int ReplyToMessagesCount { get; }
Gets or sets the date and time associated with this instance.
public DateTime TimeStamp { get; set; }
Gets or sets a user-defined object that contains custom data associated with this instance.
public object UserData { get; set; }
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
Raises the PropertyChanged event to notify listeners that a property value has changed.
protected virtual void OnPropertyChanged(string propertyName)
The name of the property that changed. This value is passed to event handlers to identify the property that was updated.
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
Occurs when a property value changes.
public event PropertyChangedEventHandler PropertyChanged
Implements:
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.