Resizing and Wrapping Text in ChatCardAction for RadChat
Environment
| Product Version | Product | Author |
|---|---|---|
| 2025.3.812 | RadChat for WinForms | Dinko Krastev |
Description
In the following tutorial, we will demonstrate how to wrap the text in ChatCardAction buttons within RadChat cards. Additionally, we will demonstrate how to increase the size of the entire chat card.

This knowledge base article also answers the following questions:
- How can I make ChatCardAction text wrap in RadChat?
- How do I increase the size of RadChat cards?
- How to customize the appearance of ChatCardAction buttons?
Solution
To resize and wrap the text in ChatCardAction buttons and increase the size of the RadChat card, use the following approach:
- Handle the
ItemFormattingevent of RadChat. - Target the
ChatImageCardElementand its child elements representing the action buttons. - Set the
TextWrapproperty to enable text wrapping for the action buttons. - Customize the size of the card by modifying its child elements.
Code Example
Use this code to enable text wrapping for ChatCardAction buttons and resize the chat card:
private void RadChat1_ItemFormatting1(object sender, ChatItemElementEventArgs e)
{
CardMessageItemElement cardMessageItemElement = e.ItemElement as CardMessageItemElement;
if (cardMessageItemElement != null)
{
LightVisualElement bubble2 = e.ItemElement.MainMessageElement;
if (e.ItemElement.MainMessageElement is ChatMessageBubbleElement bubbleElement)
{
ChatImageCardElement imageCard = bubbleElement.FindDescendant<ChatImageCardElement>();
if (imageCard != null)
{
imageCard.MaxSize = new Size(0,0);
imageCard.Children[0].MinSize= new Size(280, 350); // this is the StackLayoutPanel holding the elements
foreach (LightVisualElement lve in imageCard.Children[0].Children)
{
lve.TextWrap = true;
}
}
}
e.ItemElement.DrawFill = true;
//e.ItemElement.BackColor = Color.LightBlue;
e.ItemElement.TextAlignment = ContentAlignment.MiddleLeft;
e.ItemElement.TextWrap = true;
bubble2.TextWrap = true;
bubble2.MaxSize = new Size(280, 350);
bubble2.MinSize = new Size(280, 350);
}
}
Key Steps
- Use the
FindDescendantmethod to locate theChatImageCardElement. - Access its child elements to customize the
TextWrapproperty of action buttons. - Adjust the size of the
StackLayoutPanelholding the card elements to increase the overall card size.