I believe that we can run into issue because Popup is not yet visible when we're trying to call TransformToVisual in
public void Open() {
if(isOpen)
return;
isOpen = true;
if(currentPage.ApplicationBar != null) {
DisableAppBar();
}
ArrangePlacement();
currentPage.BackKeyPress += CurrentPageBackKeyPress;
currentPage.OrientationChanged += CurrentPageOrientationChanged;
hostPopup.IsOpen = true;
}
maybe we should call ArrangePlacement after setting IsOpen to true.
There is also another possibility that currentPage ArrangePlacement is not yet visible
void ArrangePlacement() {
maskingLayer.Dispatcher.BeginInvoke(() => {
var placement = new ElementPlacement {
Transform = (Transform)currentPage.TransformToVisual(null),
Orientation = currentPage.Orientation,
};
elementPlacementAnimator.AnimateTo(placement);
});
}