first of I would like to appreciate your framework. It is really amazing tool and realy enjoy it. However I'm facing some wierd spec. effect.
I has generated project for DataGrid population with 50 k records from csv file. all works good untill I starting populating ViewModel.Source property this is realy hanging main UI thread. I did moved as much as possible code to the async style but the best i get is slow response UI. Here is how moved my code to the async:
`
public async Task<IEnumerable> ProcessCSVData(string csvFilePath, CSVDataService service)
{
Microsoft.UI.Dispatching.DispatcherQueue dispatcherQueue = Microsoft.UI.Dispatching.DispatcherQueue.GetForCurrentThread();
List<ADUserObject> userObjects = new List<ADUserObject>();
Source.Clear();
var enumerator = service.SeedCSVFileDataAsync(csvFilePath);
Source = new ObservableCollection<ADUserObject>();
await foreach (var item in enumerator.WithCancellation(CancellationToken.None))
{
userObjects.Add(item);
Source.Add(item);
}
return userObjects;
}
`
What's intersting is that 50k records gets populated in my List for couple of ms, but once I starting use add thouse to the datagrid observable source property Source.Add(item); the things are getting really bad.
I do understand that the root cause are tons of CollectionUpdate events so I tried to cheat and re-populate Source after I get all data red in my collection as follow:
Source = new ObservableCollection<ADUserObject>(userObjects);
but once i applied this Observable collection stops receiving any events so it end's up empty no matter what you do. I may guess here that the problem is that by the time when I re-initialize Observable collection property it get's hard coded by the comipler in *.g.cs files so it broke some logic somwehre...
I'm really not claim that this is a bug, but If could help me to improve my logick and get main UI thread responsive while it populates 50k lines in Source prop I would be very apprecaite you.
Best regards,
Maks.
To Reproduce
Go to '...'
Click on '....'
Scroll down to '....'
See error
Additional context
No response
Applies to the following platforms:
[X] WinUI
[ ] WPF
[ ] UWP
About your setup
Visual Studio Version: 2022 Pro with latest updates:
Template Studio Wizard Version: 5.4
Windows Build: Windows 11 Pro 22H2 OS Build 22621.1778
Describe the bug
Dear Friends,
first of I would like to appreciate your framework. It is really amazing tool and realy enjoy it. However I'm facing some wierd spec. effect. I has generated project for DataGrid population with 50 k records from csv file. all works good untill I starting populating ViewModel.Source property this is realy hanging main UI thread. I did moved as much as possible code to the async style but the best i get is slow response UI. Here is how moved my code to the async:
` public async Task<IEnumerable> ProcessCSVData(string csvFilePath, CSVDataService service)
{
`
What's intersting is that 50k records gets populated in my List for couple of ms, but once I starting use add thouse to the datagrid observable source property
Source.Add(item);
the things are getting really bad.I do understand that the root cause are tons of CollectionUpdate events so I tried to cheat and re-populate Source after I get all data red in my collection as follow:
Source = new ObservableCollection<ADUserObject>(userObjects);
but once i applied this Observable collection stops receiving any events so it end's up empty no matter what you do. I may guess here that the problem is that by the time when I re-initialize Observable collection property it get's hard coded by the comipler in *.g.cs files so it broke some logic somwehre...I'm really not claim that this is a bug, but If could help me to improve my logick and get main UI thread responsive while it populates 50k lines in Source prop I would be very apprecaite you.
Best regards, Maks.
To Reproduce
Additional context
No response
Applies to the following platforms:
About your setup