Binding grid to less than a hundred records, it takes 5 seconds to display the form - it just has the grid on it.
I'm using virtualization, set scrolling to immediate, hiding the grid and then showing it once binding has finished (seems to shave a second off) but it is sluggish.
What else should I be doing? I notice the Grid Layout Updated fires a lot repeatedly over that 5 second period.
I have themes set on the grid which I understand slows things down a bit, and I'm loading layout previously saved - is there a preferred order in which to do this (i.e. load data first then the layout or vice-a-versa?
Will setting the EditType or DisplayType on the columns speed things up?
Any recommendations are welcome.
In my case, I am using a XamDatagrid whose DataSource is bound to a List using MVVM. The grid is way too slow to load the first time. I have just 18 columns
Thans for the quick response.That helps.
The LayoutUpdated event is expected to be called multiple times.
You are using a lot of fields, which on load will require creating a lot of presenters and inserting them in the visual tree. The performance impact can be even greater if you are running the application in full screen, showing most of the fields and more records (thus more presenters).
Note that if you resize the window so that only couple of fields are visible, the load will be much faster.
There can be done a little bit of optimization by assigning the XamDataGrid an empty data source, so that it creates the FieldLayout beforehand and then add the data objects.
I am attaching a sample project that I am using to test this. In the Bind button's Click event, try putting either the binding or the creation of the objects to see the difference.
On my machine, creating the objects and binding them directly took about 3,3.5 seconds. Loading the records after the XamDataGrid is bound to an empty collection - about 2 seconds. Loading the XamDataGrid when not in full screen, almost immediate.
Here is a sample. The grid layout updated event seems to be firing over a 5 second period a numebr of times.
Hello,
Five seconds are slow indeed. Can you provide a sample that reproduces this issue so that we can look into it?
Thanks.