BlazorChatMessage.Visible Property
Specifies whether the message is visible in the DxAIChat message area.
Namespace: DevExpress.AIIntegration.Blazor.Chat
Assembly: DevExpress.AIIntegration.Blazor.Chat.v26.1.dll
Declaration
public bool? Visible { get; set; }
Property Value
| Type | Description |
|---|---|
| Nullable<Boolean> |
|
Remarks
Use the Visible property to override the default visibility of a BlazorChatMessage in the DxAIChat message area.
When the Visible property is not set, the component determines message visibility automatically based on the following rules:
- System messages (Role equals to
ChatMessageRole.System) are hidden. - Messages being generated (where Typing equals
true) are visible. - Messages that contain at least one text content item are visible.
- Messages that contain only non-text content items (images, documents, or other binary data) are hidden.
Enable the Visible property to display a message regardless of its content type. Disable the property to hide a message that would otherwise be visible.
The following code snippet loads conversation history that includes a message with binary content and forces it to be displayed:
<DxAIChat @ref="chat" />
@code {
DxAIChat chat = default!;
protected override async Task OnAfterRenderAsync(bool firstRender) {
if(firstRender) {
chat.LoadMessages([
new BlazorChatMessage(ChatRole.User, [
new DataContent(imageBytes, "image/png")
]) { Visible = true },
new BlazorChatMessage(ChatRole.Assistant, "I can see the image you shared.")
]);
}
}
byte[] imageBytes = [];
}