- Before we were clamping indexes too early, meaning that `firstIndexU` was calculated with a non-clamped index
- `_startUUnstable` needs to be set when the remove happens before the realized elements
There's a problem with `DataBox` that I can't repro in a unit test. Add some redundancy such that if we're still waiting for a viewport update after carrying out a layout pass, force another layout.
This necessitated adding another stage to the container preparation lifecycle that will be called after the container is added to the logical and visual trees: `ItemContainerPrepared`. Such a method is going to be necessary anyway if we ever want to expose events for container realization so will probably be worth having regardless.
A lot still broken, in particular virtualization is completely removed.`ItemsPresenter` now no longer has an `Items` or `ItemTemplate` property; it detects when it's hosted in an `ItemsControl`. `IItemsPresenter` interface removed.
Add support for selection wrapping for ListBox, ItemsControl, ComboBox.
Co-authored-by: Steven Kirk <grokys@users.noreply.github.com>
Co-authored-by: Takoooooo <tako0qq@gmail.com>
Co-authored-by: Steven Kirk <grokys@gmail.com>
After items are added or removed then the virtualizing panel must be
remeasured. It's usually not remeasured if the available size is the
same as on the last measure as that causes an infinite loop; this adds a
`ForceInvalidateMeasure` to `IVirtualizingPanel` which will force a
remeasure even if the available size hasn't changed. Also adds tests for
the behavior.
This fixes the failing `Should_Add_Containers_For_Items_After_Clear`
however I'm unsure if it's the correct fix. May need to revisit if it
seems to be causing other problems.