Add container lifecycle events to ItemsControl. #10685
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does the pull request do?
Before #9677 we had materialized/dematerialized events for item containers (even though the API was pretty confused). They were removed as part of #9677 mostly to see if anyone missed them, but with the anticipation that we'd probably want to add them back. Turns out that they were being using on 0.10.x and people do miss them ;)
This PR adds them back in a slightly more sane form. The events follow the pattern used by
ItemsRepeater
, meaning that we have 3 new events onItemsControl
:ContainerPrepared
is raised each time a container is prepared for use. The prepared container might be newly created or an existing container that is being re-used.ContainerIndexChanged
is raised for each realized container where the index for the item it represents has changed. For example, when another item is added or removed in the data source, the index for items that come after in the ordering will be impacted.ContainerClearing
s raised immediately each time an container is cleared, such as when it falls outside the range of realized items or the corresponding item is removed