Good Day
i use ControlTemplate to customize the chat UI the way i want it and all is working well. im now creating the ability to delete chat messages and that works fine but the problem i have to reload the list of chat which is not good. i want to only delete a chat item
This is how i load my chat , when the chat window is opened
Author senderitem = new Author();
senderitem.Name = m.AUTHOR;
TextMessage textMessage = new TextMessage();
textMessage.Data = m;
textMessage.Author = senderitem;
textMessage.Text = Functions.DecodeString(m.CHAT_MESSAGE);
Device.BeginInvokeOnMainThread(() =>
{
chat.Items.Add(textMessage);
chat.AutoScrollMode = AutoScrollMode.Always;
});
This works well . now i use a Swipe View to get Delete which carries the Message_ID , and i just go delete the record in the database and that works well. My issue is that after deleting i dont want to reload the loadchat list again , i want to remove only the one that was deleted
How do i use Removeat(), if i am using a Template , how do i get an index of this chat item , because the Message_ID is just a model field
i have tried this but it does not
chat.Items.RemoveAt(model.CHAT_MESSAGES_ID);
which will obviously fail if the index is not correct.
Thanks