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

Update Chat messages on Datasource change

2 Answers 178 Views
Chat (Conversational UI)
This is a migrated thread and some comments may be shown as answers.
Kamran
Top achievements
Rank 3
Iron
Iron
Veteran
Kamran asked on 07 Nov 2018, 06:15 AM

Dear All,

I am new to Chat control. I am practicing RadChat in Chat application, such that I have list of contacts on Left side, which bounded to List of users where

public class User: Entity
{
        public ObservableCollection<MessageBase> Messages { get => messages; set { messages = value; RaisePropertyChange(); } }
}

I have bounded RadChat DataSource as SelectedUser.Messages property, where SelectedUser is public property in my viewmodel, which contains selected item object.

As I assume that RadChat need to updated Messages as datasource is changed, but instead of refreshing messages, it appends new messages to old one.

My requirement is to Clear all messages in Chat UI, as I have selected new Messages object as datasource.

 

Here I want to clarify that data in Messages are correct according to my need. I feel it is some issue in RadChat or I need further steps to acheive my target.

<telerik:RadChat Grid.Row="2" Margin="5 0 0 0" Name="ctrlChat"                                     CurrentAuthor="{Binding CurrentAuther,UpdateSourceTrigger=PropertyChanged}"
DataSource="{Binding SelectedUser.Messages, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}">
   <telerik:EventToCommandBehavior.EventBindings>
    <telerik:EventBinding EventName="SendMessage"
                         Command="{Binding SendMessageCommand}" PassEventArgsToCommand="True" />
     </telerik:EventToCommandBehavior.EventBindings> 
    </telerik:RadChat>

 

 

2 Answers, 1 is accepted

Sort by
0
Kamran
Top achievements
Rank 3
Iron
Iron
Veteran
answered on 11 Nov 2018, 07:51 AM

Dear Members,

I am still facing the same issue but did not came to solution. @Admin Can you please fix/ solution for above reported issue. For reference I am attaching project.

I have added 3 mock users in list. So when I select user, Rad Chat should load selected user messages.

 

NOTE: Please rename attached file to .zip

 

0
Stefan
Telerik team
answered on 14 Nov 2018, 03:09 PM
Hi Kamran,

I have already posted a reply regarding this inquiry in your other forum thread opened for this topic. In order to keep the communication consistent, may I kindly ask you to continue any further discussion regarding this inquiry in it?

Thank you in advance for understanding.

All the best,
Stefan
Progress TelerikWant to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
Chat (Conversational UI)
Asked by
Kamran
Top achievements
Rank 3
Iron
Iron
Veteran
Answers by
Kamran
Top achievements
Rank 3
Iron
Iron
Veteran
Stefan
Telerik team
Share this question
or