Let's say that, in WPF, I have a following user control:
public partial class FlipButton : UserControl
{
private Boolean _isOn = false;
}
public Boolean isOn
{
get { return _isOn; }
set { if (value) FlipBtn.Background = onColor;
else FlipBtn.Background = offColor; _isOn = value; }
}
private void FlipBtn_Click(object sender, RoutedEventArgs e)
{
isOn = !isOn;
}
with a corresponding <Button Name="FlipBtn" Click="FlipBtn_Click">
inside.
Now, I want to create a FlipButtonGroup
, which holds a collection of those buttons laid out in a grid and has an internal collection of buttons in "enabled" state. It would have to update whenever a button is clicked, and there's my question: can I somehow guarantee that updating the isOn
value will take place before the FlipButtonGroup
handles the click?