title: Get the index of Item selected in ListView
body: <p>I've been searching for about an hour already and couldn't find a best solution.
  I am migrating from VB.NET to C# Forms and to C# WPF.
  Never mind that...
  so I use this code for C# forms and it works, but not in C# WPF</p>
  
  <pre><code> if (ListView1.SelectedItems.Count &gt; 0)
              {
                  for (lcount = 0; lcount &lt;= ListView1.Items.Count - 1; lcount++)
                  {
                      if (ListView1.Items[lcount].Selected == true)
                      {
                          var2 = lcount;
                          break;
                      }
                  }
              }
  </code></pre>
  
  <p>this is the way I want to get the index of the item clicked in listbox.
  I have the error in .SELECTED</p>
  
  <p>please help.</p>