Hey there fellow coders,
I'm stuck. I need to pass a value from one form to another and then back again. Here's the story: (most of the code works)
Pseudo:
If Window1 Checkbox1 is checked pop messagebox - this works
If messagebox result = OK, pass value to Window2 Checkbox2 - this works
If SAVE on Window2 do the database write thing... and leave checkbox1 on Window1 checked - this work
If messagebox result = CANCEL, make Checkbox2 NOT checked and also make Checkbox1 on Windows1 NOT checked.
Where I'm struggling is the "reloading" or "refreshing" the Window1 after the cancel. I don't want to lose the data on Window1, I just want to "reload/reinitialize/refresh/whatever" Checkbox1 with IsChecked=false.
I can supply code, but I think What I have is wrong so let me share what I have that passes the correct value to Window2
public void Handle(CheckBox checkbox)
{
var flag = checkbox.IsChecked != null && checkbox.IsChecked.Value;
switch (flag)
{
case true;
var results = MessagebBox.Show("Message","Title",MessageBoxButton.OKCancel,MessageBoxImage.Question);
if (result == MesaageBoxResult.OK)
{
var ap = new Window2();
if (checkbox.IsChecked != null) ap.C = checkbox.IsChecked.Value;
ap.Show();
}
else
}
checkbox.IsChecked = true;
}
break;
}
}
I guess I can't figure out how to set C = false or not checked and pass that back into focus. Thoughts?