Esempio n. 1
0
        public ShellFlyoutView(IShellContext shellContext, Context context) : base(context)
        {
            _scrimBrush   = Brush.Default;
            _shellContext = shellContext;
            _flyoutHeight = LP.MatchParent;

            Shell.PropertyChanged += OnShellPropertyChanged;
            ShellController.AddAppearanceObserver(this, Shell);
        }
        public ShellFlyoutRenderer(IShellContext shellContext, Context context) : base(context)
        {
            _scrimColor   = Color.Default;
            _shellContext = shellContext;

            Shell.PropertyChanged += OnShellPropertyChanged;

            ShellController.AddAppearanceObserver(this, Shell);
        }
Esempio n. 3
0
        public ShellFlyoutRenderer(IShellContext shellContext, Context context) : base(context)
        {
            _scrimBrush   = Brush.Default;
            _shellContext = shellContext;
            _flyoutHeight = LP.MatchParent;

            Shell.PropertyChanged += OnShellPropertyChanged;
            ShellController.AddAppearanceObserver(this, Shell);

            this.DrawerClosed       += OnDrawerClosed;
            this.DrawerSlide        += OnDrawerSlide;
            this.DrawerOpened       += OnDrawerOpened;
            this.DrawerStateChanged += OnDrawerStateChanged;
        }
Esempio n. 4
0
        public ShellItemRenderer(ShellItem item)
        {
            Initialize();
            ShellItem = item;

            ShellItem.PropertyChanged += OnShellItemPropertyChanged;
            if (ShellItem.Items is INotifyCollectionChanged notifyCollectionChanged)
            {
                notifyCollectionChanged.CollectionChanged += OnShellItemsCollectionChanged;
            }
            ShellController.AddAppearanceObserver(this, ShellItem);

            UpdateTabsItems();
            UpdateCurrentItem(ShellItem.CurrentItem);
        }
Esempio n. 5
0
        void IShellFlyoutRenderer.AttachFlyout(IShellContext context, UIViewController content)
        {
            Context = context;
            Shell   = Context.Shell;
            Detail  = content;

            Shell.PropertyChanged += OnShellPropertyChanged;

            PanGestureRecognizer = new UIPanGestureRecognizer(HandlePanGesture);
            PanGestureRecognizer.ShouldRecognizeSimultaneously += (a, b) =>
            {
                // This handles tapping outside the open flyout
                if (a is UIPanGestureRecognizer pr && pr.State == UIGestureRecognizerState.Failed &&
                    b is UITapGestureRecognizer && b.State == UIGestureRecognizerState.Ended && IsOpen)
                {
                    IsOpen = false;
                    LayoutSidebar(true);
                }

                return(false);
            };

            PanGestureRecognizer.ShouldReceiveTouch += (sender, touch) =>
            {
                if (!context.AllowFlyoutGesture || _flyoutBehavior != FlyoutBehavior.Flyout)
                {
                    return(false);
                }
                var     view = View;
                CGPoint loc  = touch.LocationInView(View);
                if (touch.View is UISlider ||
                    touch.View is MPVolumeView ||
                    IsSwipeView(touch.View) ||
                    (loc.X > view.Frame.Width * 0.1 && !IsOpen))
                {
                    return(false);
                }

                return(true);
            };

            ShellController.AddAppearanceObserver(this, Shell);
            IsOpen = Shell.FlyoutIsPresented;
        }
Esempio n. 6
0
        public ShellItemView(ShellItem item, IMauiContext context)
        {
            ShellItem   = item;
            MauiContext = context;

            //Initialize();
            _mainLayout = new EBox(NativeParent);
            _mainLayout.SetLayoutCallback(OnLayout);
            _mainLayout.Show();
            _contentHolder = new EBox(NativeParent);
            _contentHolder.Show();
            _mainLayout.PackEnd(_contentHolder);

            ShellItem.PropertyChanged += OnShellItemPropertyChanged;
            if (ShellItem.Items is INotifyCollectionChanged notifyCollectionChanged)
            {
                notifyCollectionChanged.CollectionChanged += OnShellItemsCollectionChanged;
            }
            ShellController.AddAppearanceObserver(this, ShellItem);

            UpdateTabsItems();
            UpdateCurrentItem(ShellItem.CurrentItem);
        }