I know there have been issues with the CheckedItems collection in the past that have been addressed but I just came across another with some steps to reproduce.
When a form is loading, I am adding items to the list programmatically and setting the CheckState to Checked or Unchecked. In this example, all 3 items are Checked, however the CheckedItems collection is empty. This is my Watch list:
As you can see, all 3 are Checked but the CheckedItems count is 0.
This is key: the way to get that collection to be correct is to actually click on the checkbox of an item in the list. The control getting focus, selecting an item in the list do not cause it to update. Only a change in CheckState will trigger the collection to be updated.
So there is some event that is not firing to update that collection when a new list is initialized and items are added programatically. Shouldn't the .Add method check if the item added is Checked, to update the collection?
Is there any method we can call as a workaround that will get this to update properly? Otherwise it's back to looping though all Items and checking CheckState manually..
Thanks
Kerry
Hello:
In what version will we have this fix?
Thanks, luckily I am adding all the items that will be checked first, so I am just doing this:
this.ultraListFormatItems.Items.SetCheckState( CheckState.Checked );
Then adding all the items that will be Unchecked.
You are correct, this is a bug that will be addressed in a forthcoming service release. To workaround it, simply set the item's CheckState property after adding it to the Items collection.