Posted 21 October 2020, 9:57 am EST
Hi darkthanhtam,
We are sorry for the delayed response. Setting the checkedItems again will not work because the items in the checkedItems array need to have a reference in the itemsSource of the TreeView. When you reassign the itemsSource, the references of listItemSelected are broken. So, when you assign the checkedItems again, none of the items in this variable are bound to the treeview. That is why the items are not updated.
To restore the checked states, you will need to recursively iterate over each item of the TreeView and check whether the current item is in the itemsSource and whether it needs to be checked and then update the checked state accordingly.
Let us know if you face any issues while implementing this.
Regards,
Ashwin