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); }