View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0004160 | NoesisGUI | C++ SDK | public | 2025-05-13 15:19 | 2025-05-19 17:08 |
| Reporter | anton.sodergren_pdx | Assigned To | sfernandez | ||
| Priority | normal | Severity | minor | ||
| Status | resolved | Resolution | fixed | ||
| Product Version | 3.2.4 | ||||
| Target Version | 3.2.8 | ||||
| Summary | 0004160: Duplicate entries in ItemsControl when moved in and out of visual tree | ||||
| Description | We discovered an interesting issue regarding ItemsControls and ObservableCollections. Particularly when an ItemsControl is moved in and out of the visual tree while items are added and removed from the observable collection.
While the ShouldDisplay value is true, Content property (inherited from ContentControl) is set to what is defined inside of the control. While the bool is false, the Content property will be empty. So the content is only inside the visual tree while the property is true. In the example, that is while the source collection is not empty. In the above example, just setting the Visibility property instead would have been fine, but there are some other cases where we have needed the VisibilityControl for the sake of performance and avoiding error messages. The problem we're getting is the following:
As you can see, the ObservableCollection contains the right number of elements, but the ItemsControl does not, instead it contains duplicates. So the ItemsControl essentially goes out of sync with the ObservableCollection. This does not happen if we don't wrap the ItemsControl in a VisibilityControl, so that is why I assume that it has something to do with moving the ItemsControl in and out of the visual tree. Perhaps it's handling the CollectionChanged callback incorrectly somehow when this happens? | ||||
| Platform | Any | ||||
|
I was able to reproduce this scenario... working on a fix now. |
|
|
Could you please try the following patch: |
|
|
Hi! I tried applying the patch now, and it indeed solved the issue! Thanks! :D |
|
|
Great! This is solved in changeset r15608. |
|
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2025-05-13 15:19 | anton.sodergren_pdx | New Issue | |
| 2025-05-13 18:25 | sfernandez | Assigned To | => sfernandez |
| 2025-05-13 18:25 | sfernandez | Status | new => assigned |
| 2025-05-13 18:25 | sfernandez | Target Version | => 3.2.8 |
| 2025-05-13 18:25 | sfernandez | Description Updated | |
| 2025-05-15 17:23 | sfernandez | Status | assigned => feedback |
| 2025-05-15 17:23 | sfernandez | Note Added: 0010675 | |
| 2025-05-16 10:07 | sfernandez | Note Added: 0010679 | |
| 2025-05-19 16:47 | anton.sodergren_pdx | Note Added: 0010710 | |
| 2025-05-19 16:47 | anton.sodergren_pdx | Status | feedback => assigned |
| 2025-05-19 17:08 | sfernandez | Status | assigned => resolved |
| 2025-05-19 17:08 | sfernandez | Resolution | open => fixed |
| 2025-05-19 17:08 | sfernandez | Note Added: 0010714 | |
| 2025-05-19 17:08 | sfernandez | Note Edited: 0010714 |