This is a migrated thread and some comments may be shown as answers.

Get "ChatTextMessage" Object From "TextMessageItemElement" Object

1 Answer 58 Views
Conversational UI, Chat
This is a migrated thread and some comments may be shown as answers.
Iman
Top achievements
Rank 1
Iman asked on 22 Nov 2018, 11:16 AM

Hi.

When we want add a message, we create an instance from ChatTextMessage  class or ChatCardMessage class or ...

How can we access to these objects in RadChat1_ItemFormatting event? In fact I want too access to ChatTextMessage Object via TextMessageItemElement.

Thanks alot.

1 Answer, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 22 Nov 2018, 02:00 PM
Hello, Iman, 

You can access the ChatTextMessage from the visual message element as it is demonstrated in the following code snippet:

private void radChat1_ItemFormatting(object sender, ChatItemElementEventArgs e)
{
    TextMessageItemElement textItemElement = e.ItemElement as TextMessageItemElement;
    if (textItemElement != null)
    {
        ChatTextMessage msg = textItemElement.Data.Message as ChatTextMessage;
    }
}

I hope this information helps. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress TelerikRadChat for Winforms
Tags
Conversational UI, Chat
Asked by
Iman
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or