private void SetCheckboxState(int index, BoolInput boolInput) { CheckState checkState = CheckState.Indeterminate; if (boolInput.Enabled) { checkState = boolInput.Value ? CheckState.Checked : CheckState.Unchecked; } checkedListBox.SetItemCheckState(index, checkState); }
void OnBoolInput_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (InvokeRequired) { this.BeginInvoke(_delPropChanged, new object[] { sender, e }); return; } BoolInput boolInput = sender as BoolInput; int index = checkedListBox.Items.IndexOf(boolInput); if (index >= 0) { SetCheckboxState(index, boolInput); } }