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.
- C#
- VB.NET
public class FlexLayoutPanelMessageContainer : FlexLayoutPanel
Public Class FlexLayoutPanelMessageContainer
Inherits 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
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();
FlexLayoutPanelMessageContainer(message, owner)
Creates a new instance of FlexLayoutPanelMessageContainer with the given message and owner.
| Name | Type | Description |
|---|---|---|
| message | Message | The Message to display. Its User must not be null. |
| owner | ChatBox | The 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
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;
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;
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;
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
Dispose(disposing)
Clean up any resources being used.
| Parameter | Type | Description |
|---|---|---|
| disposing | Boolean | true if managed resources should be disposed; otherwise, false. |