void ToggleMenuBarItem(object sender, EventArgs e) { MenuBarItem barItem = MenuBarItems.FirstOrDefault(x => x.Text == "Added Menu"); if (barItem == null) { barItem = new MenuBarItem() { Text = "Added Menu" }; barItem.Add(new MenuFlyoutItem() { Text = "Added Flyout Item", Command = new Command(() => ItemClicked(barItem.First(), EventArgs.Empty)) }); MenuBarItems.Add(barItem); } else { MenuBarItems.Remove(barItem); } }
private void AddMenuBar(HtmlTextWriter writer, MenuBarItems menuBarItemSelected) { writer.AddAttribute(Constants.DataRole, Constants.NavbarRole); writer.AddAttribute(HtmlTextWriterAttribute.Class, "ui-state-persist"); writer.AddAttribute(Constants.DataId, "MenuBar"); writer.AddAttribute(Constants.DataPosition, Constants.PositionFixed); writer.AddAttribute(Constants.DataIconPosition, Constants.PositionBottom); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.RenderBeginTag(HtmlTextWriterTag.Ul); writer.RenderBeginTag(HtmlTextWriterTag.Li); AddMenuBarItem(writer, MenuBarItems.Stream.ToString(), "#" + MenuBarItems.Stream.ToString(), Constants.StreamIcon, Constants.SlideDown, IsMenuBarItemSelected(MenuBarItems.Stream.ToString(), menuBarItemSelected)); writer.RenderEndTag(); writer.WriteLine(); writer.RenderBeginTag(HtmlTextWriterTag.Li); AddMenuBarItem(writer, MenuBarItems.Assignments.ToString(), "#" + MenuBarItems.Assignments.ToString(), Constants.AssignmentsIcon, Constants.SlideDown, IsMenuBarItemSelected(MenuBarItems.Assignments.ToString(), menuBarItemSelected)); writer.RenderEndTag(); writer.WriteLine(); writer.RenderBeginTag(HtmlTextWriterTag.Li); AddMenuBarItem(writer, MenuBarItems.Instructor.ToString(), "#" + MenuBarItems.Instructor.ToString(), Constants.InstructorIcon, Constants.SlideDown, IsMenuBarItemSelected(MenuBarItems.Instructor.ToString(), menuBarItemSelected)); writer.RenderEndTag(); writer.RenderEndTag(); writer.RenderEndTag(); }
private void AddMenuBar(HtmlTextWriter writer, MenuBarItems menuBarItemSelected) { writer.AddAttribute(Constants.DataRole, Constants.NavbarRole); writer.AddAttribute(HtmlTextWriterAttribute.Class, "ui-state-persist"); writer.AddAttribute(Constants.DataId, "MenuBar"); writer.AddAttribute(Constants.DataPosition, Constants.PositionFixed); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.RenderBeginTag(HtmlTextWriterTag.Ul); writer.RenderBeginTag(HtmlTextWriterTag.Li); AddMenuBarItem(writer, MenuBarItems.Menu.ToString(), "#" + MenuBarItems.Menu.ToString(), Constants.MenuIcon, Constants.SlideDown, IsMenuBarItemSelected(MenuBarItems.Menu.ToString(), menuBarItemSelected)); writer.RenderEndTag(); writer.WriteLine(); writer.RenderBeginTag(HtmlTextWriterTag.Li); AddMenuBarItem(writer, MenuBarItems.About.ToString(), "#" + MenuBarItems.About.ToString(), Constants.AboutIcon, Constants.SlideDown, IsMenuBarItemSelected(MenuBarItems.About.ToString(), menuBarItemSelected)); writer.RenderEndTag(); writer.WriteLine(); writer.RenderBeginTag(HtmlTextWriterTag.Li); AddMenuBarItem(writer, MenuBarItems.Location.ToString(), "#" + MenuBarItems.Location.ToString(), Constants.ContactIcon, Constants.SlideDown, IsMenuBarItemSelected(MenuBarItems.Location.ToString(), menuBarItemSelected)); writer.RenderEndTag(); writer.RenderEndTag(); writer.RenderEndTag(); }
private bool IsMenuBarItemSelected(string currentBtn, MenuBarItems menuBarItemSelected) { return(currentBtn == menuBarItemSelected.ToString()); }