Rather than using the `ISelectable` interface to communicate container selection from the `SelectingItemsControl` to the container, use the `SelectingItemsControl.IsSelected` attached property, setting it with `SetCurrentValue` so that bindings defined in a style or item container theme can override the selection. Required an extra virtual `ContainerForItemPreparedOverride` method on `ItemsControl`.
The real Windows Maximize button has no automation ID and is localized. Get it by index instead of by name. The Avalonia one isn't localized so we can get it by name.
`EffectiveViewportChanged` can result in a viewport that is larger than the panel bounds in cases where clipping is not enabled on the parent. Constrain the viewport to the size of the panel.
Try to get an "anchor element" during measure, which is an existing element in the viewport that we know the position of. Start realizing elements from this anchor element.
We need to register controls as anchor candidates in the panel instead of in `ItemsControl` because the candidate needs to be registered after arrange. Consider this scenario:
- In Measure:
- Container is realized and registered as an anchor candidate
- Container is unrealized and unregistered
- Container is recycled and registered, but it is still placed in the position from before it was recycled
- In Arrange:
- The container is placed in its new position
- The `ScrollContentPresenter` sees it's been moved and adjusts the viewport to anchor it
This is obviously incorrect, but was what was happening when `ItemsControl` was responsible for registering anchor candidates.
Instead of tracking which containers have already been registered, change the list of anchor candidates in `ScrollContentPresenter` to a `HashSet` so we can just register it multiple times.