Skip to main content

FlexLayoutPanelMessageContainer

Namespace: Wisej.Web.Ext.ChatControl

Assembly: Wisej.Web.Ext.ChatControl (4.1.0.0)

A FlexLayoutPanel that displays a single Message inside a ChatBox, including the user's avatar, name, timestamp and the message bubble.

public class FlexLayoutPanelMessageContainer : FlexLayoutPanel

The ChatBox creates one container for each message added to its DataSource. The container requests the message control (see RenderMessageControl), sizes it to at most half the width of the chat box (up to 600 pixels), and applies the bubble color from BubbleColor or, when not set, the theme colors @highlight (current user) or @controlDark (other users).

Example:

var message = new Message("Hello!", null, chatBox.User);
var container = new FlexLayoutPanelMessageContainer(message, chatBox);
container.BubbleColor = Color.LightBlue;

Constructors​

Instance member FlexLayoutPanelMessageContainer()​

Creates a new, empty instance of FlexLayoutPanelMessageContainer.

This constructor only initializes the child controls; it does not bind a message or owner. Use #ctor to create a fully initialized container.

Example:

var container = new FlexLayoutPanelMessageContainer();

Instance member FlexLayoutPanelMessageContainer(message, owner)​

Creates a new instance of FlexLayoutPanelMessageContainer with the given message and owner.

NameTypeDescription
messageMessageThe Message to display. Its User must not be null.
ownerChatBoxThe ChatBox that owns this container. Its User must not be null.

The constructor sets the timestamp (formatted with TimestampFormat), the avatar and timestamp visibility, the bubble color, the user name and image, and requests the message control, which is added to the bubble. The message control is resized whenever the owner is resized.

Example:

var message = new Message("How can I help?", null, new User("bot", "Assistant"));
message.Timestamp = DateTime.Now;
var container = new FlexLayoutPanelMessageContainer(message, chatBox);

Properties​

Instance member BubbleColor​

Color: Returns or sets the background color of the message bubble.

Value: The back color of the bubble panel. Initialized from BubbleColor, or @highlight / @controlDark when not set, or Transparent when BubbleVisible is false.

Example:

var container = new FlexLayoutPanelMessageContainer(message, chatBox);
container.BubbleColor = Color.LightGreen;

Instance member ChatBox​

ChatBox: Returns or sets the ChatBox that owns this container.

Value: The owner ChatBox, or null when created with the parameterless constructor.

Example:

var container = new FlexLayoutPanelMessageContainer(message, chatBox);
var format = container.ChatBox.TimestampFormat;

Instance member Message​

Message: Returns or sets the Message displayed by this container.

Value: The displayed Message, or null when created with the parameterless constructor.

Example:

var container = new FlexLayoutPanelMessageContainer(message, chatBox);
var sender = container.Message.User?.Name;

Instance member MessageControl​

Control: Returns or sets the control displayed inside the message bubble.

Value: The control returned by the RenderMessageControl event, or an AutoSizeLabel showing Content by default.

Example:

var container = new FlexLayoutPanelMessageContainer(message, chatBox);
container.MessageControl.ForeColor = Color.White;

Methods​

Protected member Dispose(disposing)​

Clean up any resources being used.

ParameterTypeDescription
disposingBooleantrue if managed resources should be disposed; otherwise, false.

Implements​