Hello,
I have already used your ItemFormatting event in my code and implemented it the same way you have provided.
In my code, i have created 7-8 messages and fixed the first msg's timestamp to "6/6/2019 11:53:08 AM" and the remaining messages with timestamp of 2 minutes more than this time. Whenever the event is triggered i wrote a code which compares the timestamp of my message with this timestamp "6/6/2019 11:53:08 AM". Conditionally only the first message falls in this condition and i paint it red, which works well for first time (On load) and then when i scroll my chat, the event unnecessarily paints the remaining msgs too, which should not happen.
I am attaching my .cs file with designer please refer to it, and resolve this asap. Looking forward to your response.
Thanks.
private
void
radChat1_ItemFormatting(
object
sender, ChatItemElementEventArgs e)
{
TextMessageItemElement textItemElement = e.ItemElement
as
TextMessageItemElement;
if
(textItemElement !=
null
)
{
TextMessageDataItem obj = textItemElement.Data
as
TextMessageDataItem;
string
Msg = obj.TextMessage.Message;
ChatTextMessage msg = obj.Message
as
ChatTextMessage;
if
(msg.TimeStamp.Equals(dt))
{
e.ItemElement.ForeColor = Color.Red;
}
else
{
e.ItemElement.ResetValue(LightVisualElement.ForeColorProperty, Telerik.WinControls.ValueResetFlags.Local);
}
}
else
{
e.ItemElement.ResetValue(LightVisualElement.ForeColorProperty, Telerik.WinControls.ValueResetFlags.Local);
}
}