benruehl / adonis-ui

Lightweight UI toolkit for WPF applications offering classic but enhanced windows visuals
https://benruehl.github.io/adonis-ui/
MIT License
1.69k stars 143 forks source link

Slow ListView and Datagrid load time #150

Open Xaragua opened 3 years ago

Xaragua commented 3 years ago

In my application I have a Datagrid that is loading data from a collectionviewsource. This collectionviewsource has 1,000 records that are returned from a mocked database almost instantly but if the data is loaded asynchronously no items will show in the datagridview (same for listview). If I load the data synchronously, it will display the records but will take several seconds for the records to show. I have tested my code without Adonis and the datagrid loads almost instantly as expected.

To reproduce:

The view model is injected the data service and a call to get the collection items is made

 public VendorsPageViewModel(IServiceProvider provider, DataService dataService, UserSession session)
        {
            services = provider;
            data = dataService;
            this.session = session;
            // new Action(async () => await GetVendorsList())();
            GetVendors();
        }

and the XAML

 <DataGrid
            Grid.Row="1"
            AutoGenerateColumns="False"
            CanUserAddRows="False"
            CanUserDeleteRows="False"
            IsReadOnly="True"
            ItemsSource="{Binding VendorsCollectionView}">
            <DataGrid.Columns>
                <DataGridTextColumn
                    Width="*"
                    Binding="{Binding Name}"
                    Header="Nombre" />
                <DataGridTextColumn
                    Width="*"
                    Binding="{Binding ContactName}"
                    Header="Contacto" />
            </DataGrid.Columns>
        </DataGrid>

This issue is more noticeable when loading 60 or more items in the collection.

benruehl commented 3 years ago

Interesting find. Thanks for reporting. Maybe the virtualization does not work correctly.

I will see if I can find any reason for this. But please don't expect a solution very soon. Unfortunately, I have almost no time to work on this project at the moment. This might get better in the future though. I hope you can understand.

zhouchaoyuan commented 3 years ago

I think I met the same issue.

the XAML file: image the collection's item: image

the collection would be large.