title: WPF ListView - How to copy individual cells
body: <p>I have code where I can take a look at the SelectedItem and then output ToString() to get the record into the clipboard.</p>
  
  <p>How can I detect what cell the user is right clicking on in order to copy just that cell in the SelectedItem?</p>
  
  <p>For example, if I have Borrower Information and the user right-clicks on last name, I would like to give the ability to just copy last name to clipboard.</p>
  
  <p>Thank you!</p>
  
  <p>UPDATE:</p>
  
  <p>Here is the code that I used as suggested by Josh, it worked great:</p>
  
  <pre><code>  private void BorrowerInfoCopyClicked(object sender, RoutedEventArgs e)
          {
              BorrowerViewModel vm = this.DataContext as BorrowerViewModel;
              if (vm != null)
              {
                  Clipboard.SetData(DataFormats.Text, vm.CurrentTextBlockText);
              }
          }
  
          private void AddressCopyClicked(object sender, RoutedEventArgs e)
          {
              BorrowerViewModel vm = this.DataContext as BorrowerViewModel;
              if (vm != null)
              {
                  Clipboard.SetData(DataFormats.Text, vm.CurrentTextBlockText);
              }
          }
  
          private void lstViews_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
          {
              BorrowerViewModel vm = this.DataContext as BorrowerViewModel;
              if (vm != null)
              {
                  if (e.OriginalSource is TextBlock)
                  {
                      TextBlock txtBlock = e.OriginalSource as TextBlock;
                      vm.CurrentTextBlockText = txtBlock.Text;
                  }
  </code></pre>
  
  <p>}
          }</p>