Event

29 Jun 20181 minute to read

StateChanged event

Occurs when the value(state) of the IsChecked property is changed by either touching the check box or setting the value to the IsChecked property using C# code. The event arguments are of type StateChangedEventArgs and expose the following property:

  • IsChecked: The new value(state) of the IsChecked property.
SfCheckBox checkBox = new SfCheckBox();
checkBox.SetTitle("Unchecked State", UIControlState.Normal);
checkBox.IsThreeState = true;
checkBox.StateChanged += CheckBox_StateChanged;

private void CheckBox_StateChanged(object sender, StateChangedEventArgs e)
{
    if (e.IsChecked.HasValue && e.IsChecked.Value)
    {
         checkBox.SetTitle("Checked State", UIControlState.Normal);
    }
    else if(e.IsChecked.HasValue && !e.IsChecked.Value)
    {
         checkBox.SetTitle("Unchecked State", UIControlState.Normal);
    }
    else
    {
         checkBox.SetTitle("Indeterminate State", UIControlState.Normal);
    }
}



This demo can be downloaded from this link.