title: Get the Values from the cells (ListView & ListViewItems)
body: <p>I have a ListView. My main goal is to be able, to copy the ListViewItems to the Clipboard and then to Excel. But I have troubles to read the ListView Cells.</p>
  
  <p>To get the Columns I use:</p>
  
  <pre><code>var columnNames = new StringBuilder();
  
  foreach (GridViewColumn column in ((GridView)(listViewSolution.View)).Columns)
  {
         columnNames.Append(column.Header + "\t");
  }
  </code></pre>
  
  <p>Now I want to add the rows, but I'm only able to access the first Cell in the first column, not the second or third..:</p>
  
  <pre><code>var stringBuilder = new StringBuilder();
  
  for (int i = 0; i &lt; listViewSolution.Items.Count; i++)
  {
      stringBuilder.Append("\n");
      //foreach (GridViewColumn column in ((GridView)(listViewSolution.View)).Columns)
      //{
          //if (column.Header != null)
          //{
              ListViewItem myListBoxItem =
                  (ListViewItem)(listViewSolution.ItemContainerGenerator.ContainerFromIndex(0)); //= Index 0 -&gt; First Row, First Cell; Index 1 = Second Row, First Cell; But do we get: Second Column, First Row????
              stringBuilder.Append(myListBoxItem.Content.ToString() + "\t");
          //}
      //}
  }
  System.Windows.Clipboard.SetData(DataFormats.Text, columnNames.ToString() + stringBuilder.ToString());
  </code></pre>
  
  <p>Help would be much appreciated..</p>