title: How could I update a global collection with a async method and binding in the view?
body: <p>I am rtying to get some data from database to get the needed items for some comboBoxes. I have an async method that get all the data and it is called from the construtor. The code is this.</p>
  
  <pre><code>private async Task getDataASync()
  {
      Task&lt;List&lt;Typ01&gt;&gt; miTsk01 = VariablesGlobales.getData01Async();
      Task&lt;List&lt;Type02&gt;&gt; miTsk02 = VariablesGlobales.getData02Async();
      Task&lt;List&lt;Type03&gt;&gt; miTskT03 = VariablesGlobales.getData03Async();
      Task&lt;List&lt;Type04&gt;&gt; miTsk04 = VariablesGlobales.getData04Async();
  
  
  
      await Task.WhenAll(miTsk01,
      miTsk02,
      miTsk03,
      miTsk04).ConfigureAwait(false);
  
  
      GlobalVariables.vgData01.AddRange(miTsk01.Result);
      GlobalVariables.vgData02.AddRange(miTsk02.Result);
      GlobalVariables.vgData03.AddRange(miTsk03.Result);
      GlobalVariables.vgData04.AddRange(miTsk04.Result);
  }
  
  
  
  
  public MyViewModel()
  {
      getDataASync();
  }
  </code></pre>
  
  <p>XAML</p>
  
  <pre><code>    &lt;ComboBox
        SelectedItem="{Binding MySelectedItem01}"
        ItemsSource="{x:Static vg:VariablesGlobales.vgData01}"&gt;
      &lt;/ComboBox&gt;
  
  &lt;ComboBox
    SelectedItem="{Binding MySelectedItem02}"
    ItemsSource="{x:Static vg:VariablesGlobales.vgData02}"&gt;
  &lt;/ComboBox&gt;
  
  &lt;ComboBox
    SelectedItem="{Binding MySelectedItem03}"
    ItemsSource="{x:Static vg:VariablesGlobales.vgData03}"&gt;
  &lt;/ComboBox&gt;
  
  &lt;ComboBox
    SelectedItem="{Binding MySelectedItem04}"
    ItemsSource="{x:Static vg:VariablesGlobales.vgData04}"&gt;
  &lt;/ComboBox&gt;
  </code></pre>
  
  <p>The problem is that I get an error that says the collectionView can't be modified by another subprocess diferent than Dispatcher.</p>
  
  <p>I have tried to create a property in my view model that get the data from the global variable and the view binds this property and then it works.</p>
  
  <p>Really I don't understand very good the problem, because in the method that get the data from database, it waits until I get all the data and later I update the global collections. I thought that I was in the same thread than the main application, but it seems that I am wrong.</p>
  
  <p>How could I update the global collections to can be binded by the view?</p>
  
  <p>Thanks.</p>