title: A first chance exception of type 'System.InvalidCastException' occurred
body: <p>In my class, I've written Double click event for ListBoxItem. When clicked on the entry of the listBox, it should return that specific entry only. But in my case, though I clicked on single entry, all the entries are returned and "InvalidCastException" occures. so, how should I change to get single entry.</p>
  
  <p>Here is Double click event code:</p>
  
  <pre><code>private void ListBoxItem_DoubleClick(object sender, RoutedEventArgs e)
      {
          //Submit clicked Entry
          Harvest_TimeSheetEntry entryToPost = (Harvest_TimeSheetEntry)sender;
  
              if (!entryToPost.isSynced)
              {
                  //Check if something is selected in selectedProjectItem For that item
               if (entryToPost.ProjectNameBinding == "Select Project")
                      MessageBox.Show("Please Select a Project for the Entry");
                  else
                      Globals._globalController.harvestManager.postHarvestEntry(entryToPost);
              }
              else
              {
                  //Already synced.. Make a noise or something
                  MessageBox.Show("Already Synced;TODO Play a Sound Instead");
              }
      }
  
  In xml:
  
  &lt;ListBox x:Name="listBox1" ItemsSource="{Binding}"  Margin="0,131,0,59" ItemTemplateSelector="{StaticResource templateSelector}" ListBoxItem.MouseDoubleClick="ListBoxItem_DoubleClick"/&gt;
  </code></pre>