title: ListView Data Binding for Windows 8.1 Store Apps
body: <p>So I am trying to move a desktop program i made to an app for <code>Windows 8.1</code> using <code>Visual Studio 2013</code>.  <code>Datagrid</code> was deprecated for this release so I am trying to translate those over to a <code>ListView</code>.  I previously used <code>ListViews</code> in other desktop applications, but it looks like a lot has changed.  The problem I am having is populating my <code>ListView</code> from my database. I am connecting through a <code>WCF Service</code> and stepping through the code, I can see I am getting the right data, I just cant get it to appear in my ListView.  My preferred end result would be a 'listview' with 3 columns of information which will be editable. Previously I would use <code>ListView.View</code> and then put a <code>GridView</code> in there for the columns.  But it appears <code>ListView.View</code> is deprecated just like <code>GridView.Columns</code>.</p>
  
  <p>here is my xaml for the <code>ListView</code></p>
  
  <pre><code>&lt;ListView x:Name="lvInventory" Grid.Row="2" Style="{StaticResource listViewStyle}" ItemsSource="{Binding}"&gt;
              &lt;ListView.ItemTemplate&gt;
                  &lt;DataTemplate&gt;
                      &lt;Grid Height="200"  Width="200"&gt;
                          &lt;Grid.ColumnDefinitions&gt;
                              &lt;ColumnDefinition Width="*" /&gt;
                              &lt;ColumnDefinition Width="*"/&gt;
                              &lt;ColumnDefinition Width="*"/&gt;
                          &lt;/Grid.ColumnDefinitions&gt;
                          &lt;TextBlock x:Name="tbName" Text="{Binding InventoryName}" Width="200" Foreground="#FF0E0D0D" /&gt;
                          &lt;TextBox x:Name="tbQty" Grid.Column="1"/&gt;
                          &lt;TextBox x:Name="tbType" Grid.Column="2"/&gt;
                      &lt;/Grid&gt;
                  &lt;/DataTemplate&gt;
              &lt;/ListView.ItemTemplate&gt;
          &lt;/ListView&gt;
  </code></pre>
  
  <p>In my codebehind I am assigning the itemssource of my listview.</p>
  
  <pre><code>        VMInventory inventory = new VMInventory();            
          inventory.GetList();
          lvInventory.ItemsSource = inventory;
  </code></pre>
  
  <p><code>VMInventory</code> is my <code>ViewModel</code> where I am getting my data from the <code>WCF service</code> and that looks like:</p>
  
  <pre><code> public async Task GetList()
      {
  
              this.connection = new InventoryModelEntities(new Uri(url));
              var filteredList = from o in connection.Inventory
                                 where o.Have == false
                                 select o;
              var query = await Task.Factory.FromAsync((filteredList as DataServiceQuery).BeginExecute(null, null),
                  (result) =&gt; (filteredList as DataServiceQuery).EndExecute(result)) as IEnumerable&lt;Aurora.InventoryService.Inventory&gt;;
  
              this.inventoryList = query.ToList();
              this.currentItem = 0;
              this.onPropertyChanged("Current");
              this.IsAtStart = true;
              this.IsAtEnd = (inventoryList.Count == 0);
  }
  </code></pre>
  
  <p>One last side note, I was able to add a textbox to the <code>Grid</code> and when I <code>DataBind</code> it to <code>text="{Binding Current.InventoryName}"</code> I am able to successfully bind it.</p>