We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

ObservableCollection and INotifyPropertyChanged - does it work for live updates ?

I am looking at the ObservableCollection example for the grid.

I modify the code for an example item in ObservableBinding.razor to be like so below such that every 5 seconds CustomerID is updated triggering INotifyPropertyChanged. The CustomerID on the grid does not update in real-time.

Should it ? Or have I misunderstood ?

Paul.

  public class ObservableDatas : INotifyPropertyChanged
    {
        public ObservableDatas() {

            DoARun();
        }

        async void DoARun()
        {

            try
            {
                CustomerID = DateTime.UtcNow.ToString("yyyyMMddHHmmssFFF");

           }
            catch (Exception ex)
            {

            }

            await Task.Delay(5000);

            Task.Run(() => { DoARun(); });

        }

        public int OrderID { get; set; }
        private string customerID { get; set; }
        public string CustomerID
        {
            get { return customerID; }
            set
            {
                this.customerID = value;
                NotifyPropertyChanged("CustomerID");
            }
        }




3 Replies

RS Renjith Singh Rajendran Syncfusion Team January 20, 2020 02:10 PM UTC

Hi Paul, 

Thanks for contacting Syncfusion support. 

Based on your requirement, we have prepared a sample to perform Live update in Grid. Please download the sample from the link below, 
 
In the above sample, we have bound Observable collection as data to Grid, and updated the cell value with a delay of 100ms, once “Update Data” button is clicked. 
 
Please find the video demo from the link below, 

Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran. 



PS paul stanley June 15, 2020 05:42 AM UTC

Just to advise the video does not play.


PS Pavithra Subramaniyam Syncfusion Team June 16, 2020 12:22 PM UTC

Hi Paul, 
We have re-attached the video with MP4 format. Please download it from the below link. 
 
 
Regards, 
Pavithra S 


Loader.
Live Chat Icon For mobile
Up arrow icon