コード例 #1
0
ファイル: MenuBarItem.cs プロジェクト: zzyzy/uno
        // Menu Flyout actions
        private void ShowMenuFlyout()
        {
            if (m_button != null)
            {
                var width  = m_button.ActualWidth;
                var height = m_button.ActualHeight;

                if (SharedHelpers.IsFlyoutShowOptionsAvailable())
                {
                    // Sets an exclusion rect over the button that generates the flyout so that even if the menu opens upwards
                    // (which is the default in touch mode) it doesn't cover the menu bar button.
                    FlyoutShowOptions options = new FlyoutShowOptions();
                    options.Position      = new Point(0, height);
                    options.Placement     = FlyoutPlacementMode.Bottom;
                    options.ExclusionRect = new Rect(0, 0, width, height);
                    m_flyout.ShowAt(m_button, options);
                }
                else
                {
                    m_flyout.ShowAt(m_button, new Point(0, height));
                }

                if (m_flyout?.m_presenter != null)
                {
                    m_flyout.m_presenter.KeyDown += OnPresenterKeyDown;

                    _activeDisposables.Add(() => {
                        m_flyout.m_presenter.KeyDown -= OnPresenterKeyDown;
                    });
                }
            }
        }
コード例 #2
0
        internal void OpenFlyout()
        {
            var flyout = Flyout;

            if (flyout != null)
            {
                if (SharedHelpers.IsFlyoutShowOptionsAvailable())
                {
                    FlyoutShowOptions options = new FlyoutShowOptions();
                    options.Placement = FlyoutPlacementMode.BottomEdgeAlignedLeft;
                    flyout.ShowAt(this, options);
                }
                else
                {
                    flyout.ShowAt(this);
                }
            }
        }