Пример #1
0
        private void EnsurePopupCreated()
        {
            if (_popup == null)
            {
                ResourceResolver.ApplyResource(this, LightDismissOverlayBackgroundProperty, "FlyoutLightDismissOverlayBackground", isThemeResourceExtension: true);

                var child = CreatePresenter();
                _popup = new Windows.UI.Xaml.Controls.Popup()
                {
                    Child = child,
                    IsLightDismissEnabled = _isLightDismissEnabled,
                };

                SynchronizeTemplatedParent();

                _popup.Opened += OnPopupOpened;
                _popup.Closed += OnPopupClosed;

                _popup.BindToEquivalentProperty(this, nameof(LightDismissOverlayMode));
                _popup.BindToEquivalentProperty(this, nameof(LightDismissOverlayBackground));

                InitializePopupPanel();

                SynchronizeDataContext();
            }
        }
Пример #2
0
        private void EnsurePopupCreated()
        {
            if (_popup == null)
            {
                LightDismissOverlayBackground = Application.Current?.Resources["FlyoutLightDismissOverlayBackground"] as Brush ??
                                                // This is normally a no-op - the above line should retrieve the framework-level resource. This is purely to fail the build when
                                                // Resources/Styles are overhauled (and the above will no longer be valid)
                                                Uno.UI.GlobalStaticResources.FlyoutLightDismissOverlayBackground as Brush;

                _popup = new Windows.UI.Xaml.Controls.Popup()
                {
                    Child = CreatePresenter(),
                    IsLightDismissEnabled = _isLightDismissEnabled,
                };

                _popup.Opened += OnPopupOpened;
                _popup.Closed += OnPopupClosed;

                _popup.BindToEquivalentProperty(this, nameof(LightDismissOverlayMode));
                _popup.BindToEquivalentProperty(this, nameof(LightDismissOverlayBackground));

                InitializePopupPanel();

                SynchronizeDataContext();
            }
        }