Пример #1
0
        private void InitializePageMenu()
        {
            var Dbase = new Database();
            var Test = Dbase.GetCrayfireMenu();
            List<pageMenuItem> pageMenuItemList = new List<pageMenuItem>();

            foreach (var a in Test)
            {
                if (a.parentMenuItem == "")
                {
                    pageMenuItemList.Add(new pageMenuItem() { menuItemID = a.menuItemID, menuItem = a.menuItem, icon = a.icon, menuItemLink = a.menuItemLink });
                }
            }
            pageMenu.ItemsSource = pageMenuItemList;
        }
Пример #2
0
        private void InitializePageSubMenu(string menuItem)
        {
            subMenuPanel.Children.Clear();
            var Dbase = new Database();
            var Test = Dbase.GetCrayfireMenu();
            foreach (var a in Test)
            {
                if (a.parentMenuItem == menuItem)
                {

                    Label m = new Label
                    {
                        Style = this.FindResource("subMenuHeader") as Style,
                        Content = a.menuItemLink
                    };
                    subMenuPanel.Children.Add(m);
                    foreach (var b in Test)
                    {
                        if (a.menuItem == b.parentMenuItem)
                        {

                            Label m2 = new Label
                            {
                                Content = b.menuItemLink,
                                Tag = b.menuItemController
                            };
                            m2.MouseLeftButtonUp += new MouseButtonEventHandler(navigatePage);

                            StackPanel sp2 = new StackPanel
                            {
                                Style = this.FindResource("subMenuItem") as Style,
                            };
                            sp2.Children.Add(m2);
                            subMenuPanel.Children.Add(sp2);
                        }
                    }
                }
            }
        }