title: WinRT - UI virtualization loading images async blocking UI Thread
body: <p>I'm having problems with my image loading blocking the UI thread so my gridview is not responsive in my windows store app.</p>
  
  <p>What I'm trying to do is for the images in gridview to have a binding to image property in my view model. The value of image property is set by an async method. When app starts it loads all objects, but not the actual image data. The image data is loaded when the UI virtualization kicks in and requestes the image data via the image property bound to the image control in xaml.</p>
  
  <p>All this is done in an observablecollection.</p>
  
  <p>Here is some code:</p>
  
  <pre><code>    private ImageSource _image = null;
      private String _imagePath = null;
      public ImageSource Image
      {
          get
          {
              SetImageFromStorageFile().ContinueWith(OnAsyncFail, TaskContinuationOptions.OnlyOnFaulted);
              return this._image;
          }
      }
  
      private async Task SetImageFromStorageFile()
      {
          this.IsLoading = true;
          if (this._image == null &amp;&amp; this._imagePath != null)
          {
                  this._image = await BitmapLoader.GetPreviewImageFromStorageFile(this.StorageFile); //getting the actual data here
                  this.OnPropertyChanged("Image");
          }
          this.IsLoading = false;
      }
  </code></pre>
  
  <p>This is all working fine except that the UI becomes unresponsive when accessing the image data.</p>
  
  <p>As you can see I'm calling an async method from a property, I'm just reusing the code that I call from other places. When called from other places I can use await and the UI is responsive. The problem is that when using the gridviews UI virtualization I don't know how to run this async method without blocking the UI since properties are not possible to run async (as far as I know).</p>
  
  <p>So I just want the gridview to run this property (or method) async instead of sync, but don't know how to do it.</p>
  
  <p>Please help :)</p>