c# - Application freezing while creating visual container for DataGrid rows -
i'm working on problem has me on it's toes last weeks or so.
this not normal freezing problem solveable multi-threading, because i'm doing business logic.
i have view datagrid, datacontext viewmodel supplying observablecollection<t>
collectionviewsource
named igroupingjournal
.
<datagrid grid.row="1" itemssource="{binding source={staticresource igroupedjournal}}"> <datagrid.columns> <datagridtextcolumn binding="{binding path=datetime}" header="datetime" /> [...] </datagrid.columns> </datagrid>
usually, 50 rows having 7 columns displayed, causes application freeze while these rows generated.
i ruled out following causes this:
1.1. complex business class producing overhead -> tested data holding class, produces no increase in speed
1.2. expensive database query gets executed in gui thread due getting data via linq -> data gets fetched in workerthread caling tolist
, mapping data aforementioned holding classes
1.3. collection grouping increases overhead -> removed grouping header in collectionviewsource
.
the following tested or thought about:
2.1. tested ui virtualisation removing grouping instruction, didn't have effect, grouping desireable feature
2.2. data virtualisation - won't have effect because 50 rows have created that's shown
conclusion
i did work out of gui thread, , it's visible loadingindicator moment workerthread sends notifycollectionchanged
gui thread, whole application freezes. did encounter problem before? how did solve it? or i'm out of luck?
the reason grouping. thought remove groups collectionviewsource
, wasn't case - needed remove grouptemplate
well.
Comments
Post a Comment