Posts

Showing posts with the label Data Binding

How to Load Data Asynchronously in WPF UI using MVVM Data Binding?

Image
  Most of the content which is displayed by the WPF Application is fetched from either the database or some Web service.  Why do we need to load Data Asynchronously? We might have seen that when we wait for the content to be available it tends to freeze our WPF Application/ Main Thread. Therefore to avoid that we need to fetch large content/Data in an asynchronous fashion from the Database or Remote Server. But the challenge there is how do we update the UI asynchronously. It is also desirable to show the loading progress to the user using some spinner control so that user gets the feeling that content is loading.  We know that if we query the Web service or the Windows Service for any result it returns a Task which encapsulates the result if we are using Asynchronous version of the API. We will not be able to do direct data binding with the task which is being returned as WPF does not supports it.  Evaluating Different ways to load data in an Async Fashion One way i...