Event in Xamarin.Android Chart(SfChart)

3 Sep 2020 / 1 minute to read

StateChanged event

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

checkBox = new SfCheckBox(this);
checkBox.Text = "Unchecked State";
checkBox.IsThreeState = true;
checkBox.StateChanged += CheckBox_StateChanged;

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

CheckBox Unchecked State
CheckBox Checked State
CheckBox Indeterminate State