I've created a chat, and are now about to set the last touch on the UI and what not. I'm trying to achieve a behavior that enables name on all of the messages (including the latest)
I've attached a image for better understaind.
Thanks in advance.
9 Answers, 1 is accepted
You can use the ItemFormatting event to show the name label:
private
void
RadChat1_ItemFormatting(
object
sender, ChatItemElementEventArgs e)
{
var messageElement = e.ItemElement
as
TextMessageItemElement;
if
(messageElement !=
null
)
{
messageElement.NameLabelElement.Visibility = ElementVisibility.Visible;
}
}
I hope this helps. Should you have any other questions, do not hesitate to ask.
Dimitar
Progress TelerikRadChat for Winforms
This is not possible. We are using UI Virtualization which means that the items are updated at runtime, while scrolling for example. To use it from a button add a conditional property for this and refresh the controls with the following method:
private
void
RadButton3_Click(
object
sender, EventArgs e)
{
var view = radChat1.ChatElement.MessagesViewElement
as
ChatMessagesViewElement;
view.Update(ChatMessagesViewElement.UpdateModes.RefreshAll);
}
I hope this helps. Should you have any other questions, do not hesitate to ask.
Regards,
Dimitar
Progress TelerikRadChat for Winforms
Hello again and thanks for your reply.
I don't see how this can achieve the desired behavior as I cannot access the NameLabelElement by using this "var view = radChat1.ChatElement.MessagesViewElement as ChatMessagesViewElement;"?
I have attached my test project. It shows the approach that you can use to show hide the labels.
Let me know which part is not working for your requirement.
Regards,
Dimitar
Progress TelerikRadChat for Winforms
The behavior is what I am looking for indeed, but I'm trying to implement the behavior on the chat 'SendMessage' event. The problem is that the AutoAddUserMessages property has to be set to true, and by doing that this solution seems to be excluded to me.I know the chat is not designed for real-time chat, but I think it's very hard to work with it in that relation because of asyc blocks, and the fact that many properties can only be set throw events. But thanks for your answer.
This is done for performance reason and to separate the UI from the actual data. Since R3 2018 we exposed a UserData property in all message types. You can use this property to pas any additional information and then parse it when the message is received and set the visual properties as well.
Let me know if I can assist you further.
Regards,
Dimitar
Progress TelerikRadChat for Winforms
Hello again,
Yes that makes sense - I've been noticing the UserData property, but I couldn't find any documentation on it. Can you please provide a short example code?
Thanks in advance.
Hi Nicklas,
Yes, I have attached a sample project.
I hope this helps.
Regards,
Dimitar
Progress Telerik
RadChat for Winforms