Ejemplo n.º 1
0
 public FlyoutPage(EvasObject parent) : base(parent)
 {
     Toggled += (object?sender, EventArgs e) =>
     {
         IsPresentedChanged?.Invoke(this, new IsPresentedChangedEventArgs(IsPresented));
     };
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="System.Maui.Platform.Tizen.Native.MasterDetailPage"/> class.
        /// </summary>
        /// <param name="parent">Parent evas object.</param>
        public MasterDetailPage(EvasObject parent) : base(parent)
        {
            LayoutUpdated += (s, e) =>
            {
                UpdateChildCanvasGeometry();
            };

            // create the controls which will hold the master and detail pages
            _masterCanvas = new Canvas(this);
            _masterCanvas.SetAlignment(-1.0, -1.0);         // fill
            _masterCanvas.SetWeight(1.0, 1.0);              // expand
            _masterCanvas.LayoutUpdated += (sender, e) =>
            {
                UpdatePageGeometry(_master);
            };

            _detailCanvas = new Canvas(this);
            _detailCanvas.SetAlignment(-1.0, -1.0);         // fill
            _detailCanvas.SetWeight(1.0, 1.0);              // expand
            _detailCanvas.LayoutUpdated += (sender, e) =>
            {
                UpdatePageGeometry(_detail);
            };

            _splitPane = new Panes(this)
            {
                AlignmentX   = -1,
                AlignmentY   = -1,
                WeightX      = 1,
                WeightY      = 1,
                IsFixed      = true,
                IsHorizontal = false,
                Proportion   = _splitRatio,
            };

            _drawer = new Panel(System.Maui.Maui.NativeParent);
            _drawer.SetScrollable(_isGestureEnabled);
            _drawer.SetScrollableArea(1.0);
            _drawer.Direction = PanelDirection.Left;
            _drawer.Toggled  += (object sender, EventArgs e) =>
            {
                UpdateFocusPolicy();
                IsPresentedChanged?.Invoke(this, new IsPresentedChangedEventArgs(_drawer.IsOpen));
            };

            ConfigureLayout();

            // in case of the screen rotation we may need to update the choice between split
            // and popover behaviors and reconfigure the layout
            Device.Info.PropertyChanged += (s, e) =>
            {
                if (e.PropertyName == nameof(Device.Info.CurrentOrientation))
                {
                    UpdateMasterBehavior();
                }
            };
        }
 private void NotifyIsPresentedChanged()
 {
     IsPresentedChanged?.Invoke(this, EventArgs.Empty);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Xamarin.Forms.Platform.Tizen.Native.MasterDetailPage"/> class.
        /// </summary>
        /// <param name="parent">Parent evas object.</param>
        public MasterDetailPage(EvasObject parent) : base(parent)
        {
            LayoutUpdated += (s, e) =>
            {
                var bound = Geometry;
                // main widget should fill the area of the MasterDetailPage
                if (_mainWidget != null)
                {
                    _mainWidget.Geometry = bound;
                }

                bound.Width      = (int)((s_popoverRatio * bound.Width));
                _drawer.Geometry = bound;
            };

            // create the controls which will hold the master and detail pages
            _masterCanvas = new Canvas(this);
            _masterCanvas.SetAlignment(-1.0, -1.0);         // fill
            _masterCanvas.SetWeight(1.0, 1.0);              // expand
            _masterCanvas.LayoutUpdated += (sender, e) =>
            {
                UpdatePageGeometry(_master);
            };

            _detailCanvas = new Canvas(this);
            _detailCanvas.SetAlignment(-1.0, -1.0);         // fill
            _detailCanvas.SetWeight(1.0, 1.0);              // expand
            _detailCanvas.LayoutUpdated += (sender, e) =>
            {
                UpdatePageGeometry(_detail);
            };

            _splitPane = new Panes(this)
            {
                AlignmentX   = -1,
                AlignmentY   = -1,
                WeightX      = 1,
                WeightY      = 1,
                IsFixed      = true,
                IsHorizontal = false,
                Proportion   = s_splitRatio,
            };

            _drawer = new Panel(Forms.Context.MainWindow);
            _drawer.SetScrollable(_isGestureEnabled);
            _drawer.SetScrollableArea(1.0);
            _drawer.Direction = PanelDirection.Left;
            _drawer.Toggled  += (object sender, EventArgs e) =>
            {
                IsPresentedChanged?.Invoke(this, EventArgs.Empty);
            };

            ConfigureLayout();

            // in case of the screen rotation we may need to update the choice between split
            // and popover behaviors and reconfigure the layout
            Forms.Context.MainWindow.RotationChanged += (sender, e) =>
            {
                UpdateMasterBehavior();
            };
        }