protected void UpdateCheckedItems(int value)
{
this.isUpdatingCheckStates = true;
// Iterate over all items
for (int i = 0; i < Items.Count; i++)
{
var item = Items[i] as FlagCheckedListBoxItem;
if (item.value == 0)
{
SetItemChecked(i, value == 0);
}
else
{
// If the bit for the current item is on in the bitvalue, check it
if ((item.value & value) == item.value && item.value != 0)
SetItemChecked(i, true);
// Otherwise uncheck it
else
SetItemChecked(i, false);
}
}
this.isUpdatingCheckStates = false;
}