i've just came across a issue that i was unable to solve myself. So hopefully anyone could give me some ideas.
My problem:
So i have a checkbox which has a binding to a class variable:
//WPF
<CheckBox IsChecked="{Binding IsChecked}" Name="cb" />
//class
public class Mod
{
bool _IsChecked;
public bool IsChecked { get { return _IsChecked; } set { MainWindow.w.checkChanged(this, value); _IsChecked = value; } }
}
Now what i'm aiming for is when i click any of the checkboxes it will execute a method. This method will check different things and eventually if the checks are not met a MessageBox will show up with the buttons OK and Cancel.
When the user clicks Cancel i want to cancel the checkbox check by using my Binding on the Object.
mod.IsChecked = value;
However because the UI is not finished before the MessageBox shows up, it will finish the UI check controller after the MessageBox has been closed (I assume after it checks the Binding).
The Toggle checkbox has just been clicked (first of the 3), but the UI thread is on pause because it waits on a InvokeEnd of the MessageBox.
I hope i've made my problem clear enough. I'm not a expert in threading, especially not with WPF/Form. So hopefully somebody can help me in the right direction.
Much appreciated, Nkmol