Exemple #1
0
        private void CreateButton(ContextMenuItem hamburgerItem, StackLayout stack)
        {
            var button = new StackLayoutButton()
            {
                Vertical         = VerticalAlignment.Center,
                Horizontal       = HorizontalAlignment.Left,
                TransitionObject = new WipeTransitionObject(TransitionWipeType.PopTop),
                Alignment        = StackAlignment.Left,
            };

            if (null != hamburgerItem.Icon)
            {
                button.AddItem(new Image(hamburgerItem.Icon)
                {
                    Size             = new Vector2(24f, 24f),
                    Vertical         = VerticalAlignment.Center,
                    Horizontal       = HorizontalAlignment.Left,
                    FillRect         = true,
                    TransitionObject = new WipeTransitionObject(TransitionWipeType.PopTop)
                });
            }
            else
            {
                button.AddItem(new Shim()
                {
                    Size             = new Vector2(24f, 24f),
                    Vertical         = VerticalAlignment.Center,
                    Horizontal       = HorizontalAlignment.Left,
                    TransitionObject = new WipeTransitionObject(TransitionWipeType.PopTop)
                });
            }

            button.AddItem(new Shim()
            {
                Size = new Vector2(8f, 8f)
            });

            button.AddItem(new Label(hamburgerItem.IconText, Content, FontSize.Small)
            {
                Vertical         = VerticalAlignment.Center,
                Horizontal       = HorizontalAlignment.Left,
                TransitionObject = new WipeTransitionObject(TransitionWipeType.PopTop)
            });

            button.AddItem(new Shim()
            {
                Size = new Vector2(24f, 24f),
            });

            button.OnClick += (obj, e) => ExitScreen();
            button.OnClick += (obj, e) => hamburgerItem.ClickEvent(obj, e);

            stack.AddItem(button);
            stack.AddItem(new Shim()
            {
                Size = new Vector2(4f, 4f)
            });
        }
Exemple #2
0
        private void CreateButton(ContextMenuItem hamburgerItem, StackLayout stack)
        {
            var button = new StackLayoutButton()
            {
                Vertical         = VerticalAlignment.Center,
                Horizontal       = LeftRight ? HorizontalAlignment.Left : HorizontalAlignment.Right,
                TransitionObject = new WipeTransitionObject(TransitionWipeType.PopTop),
                Alignment        = LeftRight ? StackAlignment.Left : StackAlignment.Right,
            };

            button.AddItem(new Image(hamburgerItem.Icon)
            {
                Size             = new Vector2(32f, 32f),
                Vertical         = VerticalAlignment.Center,
                Horizontal       = LeftRight ? HorizontalAlignment.Left : HorizontalAlignment.Right,
                FillRect         = true,
                TransitionObject = new WipeTransitionObject(TransitionWipeType.PopTop)
            });
            button.AddItem(new Shim()
            {
                Size = new Vector2(16f, 16f)
            });
            button.AddItem(new Label(hamburgerItem.IconText, Content, FontSize.Small)
            {
                Vertical         = VerticalAlignment.Top,
                Horizontal       = LeftRight ? HorizontalAlignment.Left : HorizontalAlignment.Right,
                TransitionObject = new WipeTransitionObject(TransitionWipeType.PopTop)
            });
            button.OnClick += (obj, e) => ExitScreen();
            button.OnClick += (obj, e) => hamburgerItem.ClickEvent(obj, e);

            stack.AddItem(button);
            stack.AddItem(new Shim()
            {
                Size = new Vector2(8f, 8f)
            });
        }