Пример #1
0
        public MenuPage()
        {
            Icon = "settings.png";
            Title = "Menu";
            BackgroundColor = Color.FromHex("FFFFFF");

            Menu = new MenuListView();

            var menuLabel = new ContentView
            {
                Padding = new Thickness(5, 5, 5, 5),
                Content = new Label()
            };

            var layout = new StackLayout
            {
                Spacing = 0,
                Padding = new Thickness(15, 15, 15, 15),
                VerticalOptions = LayoutOptions.FillAndExpand
            };
            layout.Children.Add(menuLabel);
            layout.Children.Add(Menu);

            Content = layout;
        }
Пример #2
0
    public MenuPage()
    {
        Icon = "settings.png";
        Title = "menu"; // The Title property must be set.
        BackgroundColor = Color.FromHex ("333333");

        Menu = new MenuListView ();

        var menuLabel = new ContentView {
            Padding = new Thickness (10, 36, 0, 5),
            Content = new Label {
                TextColor = Color.FromHex ("AAAAAA"),
                Text = "MENU",
            }
        };

        var layout = new StackLayout {
            Spacing = 0,
            VerticalOptions = LayoutOptions.FillAndExpand
        };
        layout.Children.Add (menuLabel);
        layout.Children.Add (Menu);

        Content = layout;
    }
Пример #3
0
        public MenuPage()
        {
            //Icon = "settings.png";
            Title           = "Menu"; // The Title property must be set.
            BackgroundColor = Color.FromHex(UIConstants.MenuTitleColor);

            Menu = new MenuListView();

            var menuLabel = new ContentView
            {
                Padding = new Thickness(10, 36, 0, 5),
                Content = new HWLabel
                {
                    TextColor      = Color.FromHex(UIConstants.MenuTitleTextColor),
                    Text           = "MENU",
                    FontSize       = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                    FontAttributes = FontAttributes.Bold
                }
            };

            var layout = new StackLayout
            {
                Spacing         = 0,
                VerticalOptions = LayoutOptions.FillAndExpand
            };

            layout.Children.Add(menuLabel);
            layout.Children.Add(Menu);

            Content = layout;
        }
Пример #4
0
        public MenuPage()
        {
            Icon                 = "hamburger.png";
            Title                = "menu"; // The Title property must be set.
            BackgroundColor      = Color.FromRgba(0, 0, 0, 0.4);
            LastAddedMovieLayout = new StackLayout()
            {
                Padding = new Thickness(0, 0, 0, 20)
            };
            Menu = new MenuListView();
            var layout = new StackLayout
            {
                Spacing         = 0,
                VerticalOptions = LayoutOptions.FillAndExpand,
                Padding         = new Thickness(0, 10, 0, 0)
            };

            topMenuStackLayout = new AbsoluteLayout()
            {
                HeightRequest = 125
            };
            var menuLabel = new ContentView
            {
                Padding = new Thickness(0, 0, 0, 0),
                Content = topMenuStackLayout
            };

            menuImage = new Image()
            {
                Source = "icon.png", Aspect = Aspect.AspectFit
            };
            lastAddedLabel = new Label()
            {
                Text = "*****@*****.**", FontSize = Device.GetNamedSize(NamedSize.Small, this), TextColor = Color.White, HorizontalOptions = LayoutOptions.Center
            };
            AbsoluteLayout.SetLayoutFlags(menuImage, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(menuImage, new Rectangle(0f, 0f, 1f, 1f));
            topMenuStackLayout.Children.Add(menuImage);
            LastAddedMovieLayout.Children.Add(menuLabel);
            LastAddedMovieLayout.Children.Add(lastAddedLabel);
            layout.Children.Add(LastAddedMovieLayout);
            layout.Children.Add(new BoxView()
            {
                HeightRequest = 0.5f, Color = Color.White
            });
            //}
            layout.Children.Add(Menu);

            Content = layout;
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            MenuListView.Initialize();
            var menuItems = new SourceListItem("Pages");

            menuItems.AddItem("Home", "home.png", () => { ViewModel.ShowHomeCommand.Execute(); });
            menuItems.AddItem("Help", "help.png", () => { ViewModel.ShowHelpCommand.Execute(); });
            menuItems.AddItem("Settings", "settings.png", () => { ViewModel.ShowSettingCommand.Execute(); });


            // TODO: There is a really odd bug here, if the Window covers the super category "Pages", the buttons
            // will stop working.

            MenuListView.AddItem(menuItems);
            MenuListView.ReloadData();
            MenuListView.ExpandItem(null, true);
        }
Пример #6
0
        public SideMenuPage()
        {
            Title = "Pokémon";
            if (Device.RuntimePlatform == Device.iOS)
            {
                Icon = "menu.png";
            }

            var containerGrid = new Grid
            {
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
                }
            };

            var titleLabel = new Label()
            {
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                Text     = Title,
                HorizontalTextAlignment = TextAlignment.Center,
                Margin = 10
            };

            var menuList = new MenuListView();

            menuList.ItemSelected += InternalMenuItemSelected;

            containerGrid.Children.Add(titleLabel);
            containerGrid.Children.Add(menuList, 0, 1);

            Content = containerGrid;
        }
Пример #7
0
        public MenuPage()
        {
            Icon = "UserMenu.png";
            Title = "menu"; // The Title property must be set.
            //BackgroundColor = Color.FromHex ("333333");

            Menu = new MenuListView ();

            var menuLabel = new ContentView {
                Padding = new Thickness (10, 36, 0, 5),
                Content = new Label {
                    TextColor = Color.FromHex ("AAAAAA"),
                    Text = "Plenty",
                }
            };

            var layout = new StackLayout {
                Spacing = 0,
                VerticalOptions = LayoutOptions.FillAndExpand
            };
            layout.Children.Add (menuLabel);
            layout.Children.Add (Menu);

            /*var logoutButton = new Button { Text = "Logout",BackgroundColor=Color.Gray };
            logoutButton.Clicked += (sender, e) => {
                App.Current.Logout();
            };*/

            Content = new StackLayout {
                //BackgroundColor = Color.Gray,
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children = {
                    layout,
                    //logoutButton
                }
            };
        }
        public MenuListView <HorizontalMenuItem> AddHorizontalMenu(string id, HorizontalMenuOptions options, string width = null)
        {
            var listView = new MenuListView <HorizontalMenuItem>(Page)
            {
                Divided  = true,
                Inverted = true,
                Pointing = true,
                Vertical = true,
                Width    = width ?? DefaultWidth,
            };

            listView.Extensions.Add <Transition>();

            if (options.GetText != null)
            {
                options.RefreshItem = (item) =>
                {
                    var v = options.GetText(item.Id);
                    if (listView?.IsRemoved != false)
                    {
                        return;
                    }
                    item.Value = v;
                    listView.UpdateItem(item);
                };
            }

            listView.OnItemSelected += (item) =>
            {
                PopTo(id, true);
                options.OnSelected?.Invoke(item.Data);
            };

            HtmlControlBase mainContainer = listView;

            if (options.ShowSearchBox)
            {
                mainContainer = new Div(Page)
                {
                    Height  = "100%",
                    Classes = new List <string> {
                        "ui", "inverted", "segment"
                    }
                };

                var searchBox = new TextBox(Page)
                {
                    Placeholder     = "Search...",
                    InstantFeedback = TimeSpan.FromMilliseconds(50)
                };
                searchBox.OnTextChanged += (sender, previous, newText) =>
                {
                    newText = newText.ToLower();
                    foreach (var item in listView.Items.DataEnumerator)
                    {
                        if (item.Data.Name.ToLower().Contains(newText))
                        {
                            item.Container.Visible = VisibleState.Block;
                        }
                        else
                        {
                            item.Container.Visible = VisibleState.None;
                        }
                    }
                };


                mainContainer.Children.Add(new Div(Page)
                {
                    Classes = new List <string> {
                        "ui", "input"
                    },
                    Width    = width ?? DefaultWidth,
                    Height   = "40px",
                    Children = new List <Core.ControlBase>
                    {
                        searchBox
                    }
                });
                mainContainer.Children.Add(listView);
            }

            mainContainer.Height  = "100%";
            mainContainer.Visible = VisibleState.None;
            mainContainer.Float   = FloatDirection.Left;
            mainContainer.CssProperties.AddRange(new Dictionary <string, string>
            {
                ["margin-top"]   = "0px",
                ["margin-right"] = "3px",
                ["margin-left"]  = Stacks.Count == 0 ? "0px" : "3px",
                ["overflow-y"]   = "auto"
            });

            listView.OnGenerateItem += (HtmlControlBase container, HorizontalMenuItem obj) =>
            {
                container.Children.Clear();

                container.Children.Add(new Span(Page, obj.Name));
                if (!obj.RequireLoading)
                {
                    return;
                }

                if (obj.Value == null)
                {
                    container.Children.Add(new Html.LoadingIcon(Page));

                    Page.Manager.Invoke(() => options.RefreshItem(obj));
                }
                else
                {
                    container.Children.Add(new Span(Page, obj.Value)
                    {
                        Classes = new List <string> {
                            "ui", "label"
                        }
                    });
                }
            };


            Stacks.Push(new HorizontalStackItem()
            {
                Control = mainContainer,
                Id      = id,
                Tag     = options
            });
            Children.Add(mainContainer);


            //mainContainer.Transition(Transition.Animation.SlideRight);
            mainContainer.Visible = VisibleState.Block;

            if (options.PopulateListView != null)
            {
                Page.Manager.Invoke(() => options.PopulateListView(listView));
            }

            return(listView);
        }