When a native popup window is positioned relative to a placement target on
the root window and the root window is moved or resized, the popup position
should update to reflect the new position of the placement target.
If a native popup window is positioned relative to another popup, as in the
case of sub-menus, and the parent popup is moved due to a change in the
position of its placement target, the child popup should also update
relative to the new position of the parent popup.
A few `AutoScrollToSelectedItem` improvements:
- Scroll to current selected item when it's set to true
- Scroll to current selected item when list first displayed
- Scroll to current selected item when attached to visual tree if the selection was changed while it wasn't attached
Fixes#4100
`SelectionModel` needs to subscribe to `CollectionChanged` on the items before `ItemsControl` in order for the selection to be correct when we come to setting the selected state.
Because `SelectionModel.Source` isn't subscribed during initialization in `ItemsChanged`, we also need to make sure we don't subscribe `ItemsControl` to the collection changes during initialization. Instead subscribe in `OnInitialized` (this requires a few tests to be rooted in order to be called).
Fixes#4293
`Changing_Resource_In_Templated_Parent_Should_Affect_Templated_Child` now fails because resource changed messages no longer traverse into templated children.
So that the event can be marked as handled if necessary. Mark the event as handled in `AutoCompleteBox`, `ComboBox` and `DatePicker`, but _not_ `ContextMenu`. Fixes#3760.