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

Question - Modify ObservableCollection from Non-UI-Thread #49

Open
greycoding opened this issue Feb 6, 2022 · 0 comments
Open

Question - Modify ObservableCollection from Non-UI-Thread #49

greycoding opened this issue Feb 6, 2022 · 0 comments

Comments

@greycoding
Copy link

First of all: the YouTube videos are really amazing! So much knowledge is transported.

However, I have a problem of understanding:
I get data from a server via a REST API. If I want to add this data to the ObservableCollection, I get the error message that this is only possible from the UI thread.

System.NotSupportedException: 'This type of CollectionView does not support changes to its SourceCollection from a thread different from the Dispatcher thread.'

So far I have made the following call for it:

App.Current.Dispatcher.Invoke ((Action) delegate ...);

But since I wanted to separate the ViewModels from the UI (as in Video 11), I don't know how to do it.
There doesn't seem to be any problems with the Fasetto.Word.Core project. In the corresponding SourceCode I also cannot find a (direct) call to the dispatcher. Is this because the filtering is also carried out on the UI thread? Or has something to do with the IOC (container)?How would you modify the ObservableCollections from a non-UI thread?

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