Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
85
CheckedItems problem - more info
posted

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

 

 

Parents
  • 69832
    Verified Answer
    Offline posted

    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.

Reply Children
No Data