If you implement INotifyPropertyChanged, you could raise event in non-UI thread – should i avoid this and why?
Update: It is about binding in wpf application.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No you should not avoid this. WPF marshals
PropertyChangedevents to the UI thread on your behalf, but even if it did not, it is likely not the component’s responsibility to do so.UPDATE: I slightly misinterpreted your question. For some reason I thought you were asking specifically about background components not directly related to UI.
If your component is intended for direct consumption by the UI, then it may make sense to marshal changes to the UI thread, such as with Windows Forms. However, if the component is UI agnostic, it does not generally make sense, although if necessary you can switch to the UI thread in an agnostic fashion by using the current
SynchronizationContext.I do marshalling as and when needed with WPF, because as I stated normally you don’t need to since WPF does it for you. But if you’re changing collections too then you will need to, since such changes are not automatically marshalled.