Exemplo n.º 1
0
        /// <summary>
        /// Configure the layout of DrawerBox to split or popover
        /// </summary>
        void ConfigureLayout()
        {
            _panel.SetContent(null, true);
            _panel.Hide();

            _splitPane.SetLeftPart(null, true);
            _splitPane.SetRightPart(null, true);
            _splitPane.Hide();

            UnPackAll();

            // the structure for split mode and for popover mode looks differently
            if (IsSplit)
            {
                _splitPane.SetLeftPart(_drawerBox, true);
                _splitPane.SetRightPart(_contentBox, true);
                _splitPane.Proportion = (SplitRatio > 0) ? SplitRatio : this.GetSplitRatio();
                _splitPane.Show();
                PackEnd(_splitPane);

                _mainWidget = _splitPane;

                if (!IsOpen)
                {
                    IsOpen = true;
                    Toggled?.Invoke(this, EventArgs.Empty);
                }
            }
            else
            {
                _panel.SetContent(_drawerBox, true);
                _panel.Show();

                if (_panel.IsOpen)
                {
                    _dimArea.Show();
                }

                PackEnd(_contentBox);
                PackEnd(_dimArea);
                PackEnd(_panel);

                _mainWidget = _contentBox;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Composes the structure of all the necessary widgets.
        /// </summary>
        void ConfigureLayout()
        {
            _drawer.SetContent(null, true);
            _drawer.Hide();

            _splitPane.SetLeftPart(null, true);
            _splitPane.SetRightPart(null, true);
            _splitPane.Hide();

            UnPackAll();

            // the structure for split mode and for popover mode looks differently
            if (IsSplit)
            {
                _splitPane.SetLeftPart(_flyoutCanvas, true);
                _splitPane.SetRightPart(_detailCanvas, true);
                _splitPane.Show();
                _mainWidget = _splitPane;
                PackEnd(_splitPane);

                IsPresented = true;
                UpdateIsPresentChangeable?.Invoke(this, new UpdateIsPresentChangeableEventArgs(false));
                UpdateFocusPolicy(true);
            }
            else
            {
                _drawer.SetContent(_flyoutCanvas, true);
                _drawer.Show();
                _mainWidget = _detailCanvas;
                PackEnd(_detailCanvas);
                PackEnd(_drawer);

                _drawer.IsOpen = IsPresented;
                UpdateIsPresentChangeable?.Invoke(this, new UpdateIsPresentChangeableEventArgs(true));
                UpdateFocusPolicy();
            }

            _flyoutCanvas.Show();
            _detailCanvas.Show();

            // even though child was changed, Layout callback was not called, so i manually call layout function.
            // Layout callback was filter out when geometry was not changed in Native.Box
            UpdateChildCanvasGeometry();
        }