public void AppendPage(SidebarPage page) { page.Sidebar = this; page.CanSelectChanged += HandleCanSelectChanged; pages.Add(page); string label = page.Label; string icon_name = page.IconName; notebook.AppendPage(page.SidebarWidget, new Label(label)); page.SidebarWidget.Show(); MenuItem item; if (icon_name == null) { item = new MenuItem(label); } else { item = new ImageMenuItem(label); (item as ImageMenuItem).Image = new Image(); ((item as ImageMenuItem).Image as Image).IconName = icon_name; } item.Activated += HandleItemClicked; choose_menu.Append(item); item.Show(); if (notebook.Children.Length == 1) { choose_button.Label = label; choose_button.Image.IconName = icon_name; } menu_list.Add(label); image_list.Add(icon_name); }
public bool IsActive(SidebarPage page) { return(Notebook.GetNthPage(Notebook.CurrentPage) == page.SidebarWidget); }