title: Display data in WPF Listview
body: <p>I am developing wpf application, in which i have listview control. I am very new to wpf. But managed to add some styles and display horizontal gridlines inside Listview as below,</p>
  
  <pre><code> &lt;DataTemplate x:Key="IDBorderedCellTemplate"&gt;
  
                  &lt;Border BorderBrush="Black" Margin="0,5,0,1"
  
                  BorderThickness="0,0,0,1" &gt;
  
                      &lt;TextBlock Foreground="MediumBlue" FontFamily="Calibri" Margin="3,0,0,2" Text=""
                  /&gt;
  
                  &lt;/Border&gt;
              &lt;/DataTemplate&gt;
  
  
   &lt;ListView.View&gt;
  
                  &lt;GridView ColumnHeaderContainerStyle="{StaticResource myHeaderStyle}"&gt;
  
                      &lt;!-- Product ID --&gt;
  
                      &lt;GridViewColumn
  
  
  
            CellTemplate="{StaticResource IDBorderedCellTemplate}"&gt;
  </code></pre>
  
  <p>Now my problem is i am uable to display items in listview when window is loaded, which is displaying only gridlines. As my requirement is i have a browse button which i browse files, these browsed files must be displayed in listview. </p>
  
  <p>As in load event i am adding following lines of code,</p>
  
  <pre><code>    try
      {
  
          listviewitem = new ListViewItem();
          //displays only the filename in the listview
          listviewitem.Content = System.IO.Path.GetFileName(_name);
          _listFiles.Items.Add(listviewitem);
      }
      catch (Exception)
      {
     }
  </code></pre>
  
  <p>This data is not displaying in listview after adding the gridview settings in xaml. Now its displays only gridlines.
  Any suggesions/help is appreciable.</p>
  
  <p>Regards
  Ravi</p>