private void EnsurePopupCreated() { if (_popup == null) { ResourceResolver.ApplyResource(this, LightDismissOverlayBackgroundProperty, "FlyoutLightDismissOverlayBackground", isThemeResourceExtension: true, isHotReloadSupported: true); var child = CreatePresenter(); _popup = new Popup() { Child = child, IsLightDismissEnabled = _isLightDismissEnabled, AssociatedFlyout = this, }; SynchronizePropertyToPopup(Popup.TemplatedParentProperty, TemplatedParent); _popup.Opened += OnPopupOpened; _popup.Closed += OnPopupClosed; _popup.BindToEquivalentProperty(this, nameof(LightDismissOverlayMode)); _popup.BindToEquivalentProperty(this, nameof(LightDismissOverlayBackground)); InitializePopupPanel(); SynchronizePropertyToPopup(Popup.DataContextProperty, DataContext); SynchronizePropertyToPopup(Popup.AllowFocusOnInteractionProperty, AllowFocusOnInteraction); SynchronizePropertyToPopup(Popup.AllowFocusWhenDisabledProperty, AllowFocusWhenDisabled); } }