Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VirtualizingObservableCollection.Add does not add 0th item. #16

Open
YellowJacket86 opened this issue Sep 9, 2016 · 1 comment
Open

Comments

@YellowJacket86
Copy link

VirtualizingObservableCollection.Add calls InternalAdd, which uses the Provider or ProviderAsync as IEditableProvider. In this case, that method is PaginationManager.OnAppend. PaginationManager.OnAppend determines the page to use. If the call to IsPageWired succeeds, the item gets added. Otherwise, it does not. In both cases, the _LocalCount gets updated, and for cases where the provider is async, a test GetAt is performed - that function will ultimately call SafeGetPage, which will cause the page to get "wired"

The result is, the 0th item does not get added because the page is not "wired", but subsequent items for async providers get added because the test GetAt wires the page via a call to SafeGetPage.

OnInsert, OnRemove and OnReplace all follow that pattern. Is there any reason to not just call SafeGetPage instead of the "wired" check?

I am using an asynchronous provider derived from PagedSourceProviderMakeAsync where I have implemented _FuncGetItemsAt and friends to retrieve records from cache as requested. Should I be using Add, Insert, etc. functions on the VisualiziingObservableCollection object? So far, that is the only way I have found I can make the item count update without calling OnReset with either -1 or my packet count, which results in bad things when receiving data at a high rate....

@YellowJacket86
Copy link
Author

YellowJacket86 commented Sep 9, 2016

I "solved" the problem by trying to assign a record to the 0th entry, and just eating the exception that is thrown. That wires the page so that the first Add works.

Now I see that the scroll performance of my DataGrid is terrible while adding records. I am adding thousands per minute, and will have totals in the millions. The scroll performance of a regular ObservableCollection is great, but once I get above 350,000 or so records, I run out of memory (hence the desire to virtualize the data). Suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant