Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Checkbox resets when dialog result for messagebox is no

$
0
0

So I have a checkbox in my datagrid. I click it and a messagebox opens up:

  public void Checked(Opcina opc)
{
                 opc.Status = 0;
                 if (MessageBox.Show("Želite li ukloniti općinu?","Potvrda", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                 Opcine.Remove(opc);
                 else
                 {
                 }

Now this all works, but as you can see my else statement is just empty. So what happens is that the checkbox will go from checked to unchecked and I don't want that. I want it to stay checked if the user presses no. I want nothing to change, but the checkbox changes.

How can I prevent that?


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>