SfChat does not update UI when messages are added to observablecollection

Hi,

We use the SfChat control and works as expected on page load. We are using MVVM and have a binding declared for Messages. When new TextMessage objects are added to the collection, the UI does not update.

Syncfusion SfChat -18.4.0.39
Xamarin.Forms - 5.0.0.1931

Property Definition:

 private ObservableCollection<object> _messages = new ObservableCollection<object>();

        public ObservableCollection<object> Messages
        {
            get { return _messages; }

            set
            {
                _messages = value;
                RaisePropertyChanged(() => Messages);   
            }
        }

XAML Declaration:

<sfChat:SfChat Messages="{Binding Messages}"
                           ShowOutgoingMessageAvatar="True"     
                           ShowIncomingMessageAvatar="True"
                           MessageShape="RoundedRectangle"
                           ShowTimeBreak="True"
                           BackgroundColor="Transparent"    
                           ShowOutgoingMessageAuthorName="False"
                           ShowIncomingMessageAuthorName="True" 
                           OutgoingMessageTimestampFormat="T"
                           IncomingMessageTimestampFormat="T"
                           IsBusy="{Binding IsSending}"
                           CanAutoScrollToBottom="True"
                           SendMessageCommand="{Binding SendMessageCommand}"
                           CurrentUser="{Binding CurrentUser}" >

Please advise.

Kind regards,

Paul


1 Reply 1 reply marked as answer

PK Pradeep Kumar Balakrishnan Syncfusion Team February 2, 2021 02:06 PM UTC

Hi Paul, 
 
Thank you contacting Syncfusion support.  
 
We have prepared sample based on the provided details and checked the reported issue “Added message to SfChat messages in run time is not reflected in view in Xamarin forms.” Unfortunately, we cannot be able to replicate the issue. We have attached the tested sample for your reference in the following link. 
 
Can you please check the sample with your device and let us know the issue persist in the provided sample as well? If not kindly modify the sample based on your scenario and revert to us with the details. It will be helpful for us to check on it and provide you the solution. 
 
Regards, 
Pradeep Kumar B 


Marked as answer
Loader.
Up arrow icon