title: Confirmation Box in C# wpf
body: <p>I want to show confirmation Box in C# code. I've seen above solution for that but it shows me exception at 'Yes' as 'System.Nullable' does not contain definition for 'Yes'. How should I remove this error?</p>
  
  <pre><code> private void listBox1_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
      {
          if (sender is ListBoxItem)
          {
              ListBoxItem item = (ListBoxItem)sender;
              Harvest_TimeSheetEntry entryToDelete = (Harvest_TimeSheetEntry)item.DataContext;
  
              DialogResult dialogResult = System.Windows.Forms.MessageBox.Show("Are you sure?", "Delete Confirmation", MessageBoxButtons.YesNo);
  
              if (dialogResult == DialogResult.Yes)  // error is here
              {
                  Globals._globalController.harvestManager.deleteHarvestEntry(entryToDelete);
              }
              else
              {
                  System.Windows.MessageBox.Show("Delete operation Terminated");
              }
  
          }
      }
  </code></pre>