Swapping children between parents doesn't show correctly with Realm dotnet binding
I'm trying to use the liveliness of Realm objects to populate and change an SfTreeView.
Mostly works except when I reassign one child(picture) from one place to another.
After changing the picture parent the count of pictures in both places are updated correctly.
Even the Assignee shows the new parent but the actual picture doesn't get removed from the tree(the database is correctly updated)
but it is added correctly in the new parent. Also adding a picture to the old place works.
Of course if I re-query the source it shows everything correctly but i prefer to the expanded nodes updated correctly without re-querying.
Do you have any suggestions to make the tree update the removed child without re-querying?
Thanks
Attachment: RealmSfTreeViewTest_cdbf74ec.zip
Thanks for reaching out to us.
Best Regards,
Muthupandy R.
Sorry for the inconvenience caused. The validation for the reported issue is still in progress, and our team is actively working on it.
Best Regards,
Muthupandy R.
Hi George DAlessio,
Thank you for your patience. We have validated the reported scenario.
When changing a child node from one parent node to another at runtime in SfTreeView, the behavior you are encountering is related to binding live Realm objects to the TreeView.
Internally, re‑parenting a node involves two operations:
- Removing the child node from the old parent
- Adding the same child node to the new parent
Since Realm invalidates objects during the remove operation, the TreeView may not correctly process the subsequent add operation when Realm objects are used as the ItemsSource. As a result, the UI does not always reflect the re‑parenting operation as expected.
Additionally, we verified this behavior with CollectionView, and the same scenario occurs there as well. The collection change notifications are not properly propagated to the ItemsSource bindable property when Realm‑managed objects are removed or reassigned. This appears to be a framework‑level behavior when working with live Realm objects, rather than an issue specific to SfTreeView.
As a workaround, this scenario requires either:
- A manual update of the ItemsSource (for example, resetting or rebuilding the collection), or
- Preferably, the use of a detached ViewModel wrapper.
Regards,
Sowntharya J.
- 3 Replies
- 3 Participants
-
GD George DAlessio
- Apr 27, 2026 10:29 PM UTC
- May 5, 2026 01:29 PM UTC