Observable Collection OnPropertyChanged Performance Issue

Muhesh Kumar 0 Reputation points
2024-08-01T12:03:13.92+00:00

While Updating Values to Observable Collection, OnPropertyChanged() takes a lot of time to load and render in UI. Because of this it's takes around a minute to update the list and taking lot of time for updating if few more list updating at the same time. Xamarin support also stopped but in Xamarin it just completes all values updated and render the UI within a fraction of seconds but in Maui it's around a minute...a huge difference. If Possible, please try to fix this issue quickly, it would be more helpful for me and peoples those who using Maui.

and one more issue, when setting a main page with some large data in Maui as Application.Current.MainPage = custompage() takes around more that 30 seconds but in Xamarin it just done it within 3 secs. please fix this if possible quickly, it would more helpful and waiting for some additional features in future for maui... Thanks in advance

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,981 questions
{count} votes

5 answers

Sort by: Most helpful
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 35,996 Reputation points Microsoft External Staff
    2024-08-08T02:26:53.88+00:00

    Hello,

    ObservableCollection<T> class provides notifications internally when items get added or removed, or when the whole list is refreshed.

    So, you don't have to implement the OnPropertyChanged(); method in the set method of CustomList. And you could delete

    private ObservableCollection<CustomModel> customList;
    public ObservableCollection<CUstomModel> CustomList.....
    

    adding and updating dynamically whenever required, while doing that its take lot of time to update

    When you want to add the item, please call CustomList.Add(item)

    When you want to set other groups and update the itemsource, you could remove all items in the ObservableCollection, then add new items.

    For example:

    CustomList.Clear();//remove all items
    if (CustomList.Contains(item))
    {
        CustomList.Remove(item);// remove a item
    }
    

    Best Regards, Wenyan Zhang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Muhesh Kumar 0 Reputation points
    2024-08-25T06:22:00.86+00:00

    Hi Wenyan, Sorry for the late reply, was little busy with another project I tried but it was working fine while building but in some between period of time, I re-initialize the list, and it was updated in the backend, but it doesn't update in the UI without ONPROPERTYCHANGED() is there any fix for this quickly, we depend on this because only issue I'm currently facing with MAUI is this Time Performance issue. Could you please share to product or development team regarding this issue. it would be more helpful and user friendly if this time performance issue was fixed and recycling process for rendering the UI Components quickly as how Xamarin works because why i'm saying is, one saw of the user document which he mentioned in xamarin he tried with 3000 data to render the UI and it was updated within the seconds but in Maui tried with just 300 data but it takes around 1 to 2 mins...it was a taking too time. please help us to fix this Thank you so much and waiting for the fixes from you

    0 comments No comments

  3. Muhesh Kumar 0 Reputation points
    2024-08-25T06:24:02.4766667+00:00

    Hi Wenyan, Sorry for the late reply, was little busy with another project I tried but it was working fine while building but in some between period of time, I re-initialize the list, and it was updated in the backend, but it doesn't update in the UI without ONPROPERTYCHANGED() is there any fix for this quickly, we depend on this because only issue I'm currently facing with MAUI is this Time Performance issue. Could you please share to product or development team regarding this issue. it would be more helpful and user friendly if this time performance issue was fixed and recycling process for rendering the UI Components quickly as how Xamarin works because why i'm saying is, one saw of the user document which he mentioned in xamarin he tried with 3000 data to render the UI and it was updated within the seconds but in Maui tried with just 300 data but it takes around 1 to 2 mins...it was a taking too time. please help us to fix this.

    Thank you so much and waiting for the fixes from you

    0 comments No comments

  4. Muhesh Kumar 0 Reputation points
    2024-08-25T06:26:39.8233333+00:00

    Hi Wenyan, Sorry for the late reply. I tried but it was working fine while building but in some between period of time, I re-initialize the list, and it was updated in the backend, but it doesn't update in the UI without ONPROPERTYCHANGED() is there any fix for this quickly, we depend on this because only issue I'm currently facing with MAUI is this Time Performance issue. Could you please share to product or development team regarding this issue. it would be more helpful and user friendly if this time performance issue was fixed and recycling process for rendering the UI Components quickly as how Xamarin works because why I'm saying is, one saw of the user document which he mentioned in Xamarin he tried with 3000 data to render the UI and it was updated within the seconds but in Maui tried with just 300 data but it takes around 1 to 2 mins...it was a taking too time. please help us to fix this. Thank you so much and waiting for the fixes from you

    0 comments No comments

  5. Muhesh Kumar Nagarajan 0 Reputation points
    2025-03-06T12:33:33.4066667+00:00

    Found the issue and fixed, Thank you everyone who helped me for this issue the root cause is when already initailized any observablecollection when reload page with rendered in xaml with some more collections inside the template its take some time to render for each item, thats why it was taken a lot of time after do changes to the observablecollection...if we dont have any change in list and again reinitialize it will not take so much time but after do update/add/delete it will take time to render xaml the fix for this when reinitialize for whole page with the observable collection just remove binding of the observablecollection and after that it will loads fast, but if going to use same page dont remove binding, only if reload page with same observable collection which already rendered the xaml with that collection only have this fix Thank you all

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.