private TabItem CreateNewTab(int index) { TabItem newItem = new TabItem(); newItem.Header = $"Document {index}"; TabItemHelper.SetIcon(newItem, new SymbolIcon(Symbol.Document)); // The content of the tab is often a frame that contains a page, though it could be any UIElement. Frame frame = new Frame(); frame.Navigated += (s, e) => { ((FrameworkElement)frame.Content).Margin = new Thickness(-18, 0, -18, 0); }; switch (index % 3) { case 0: frame.Navigate(typeof(SamplePage1)); break; case 1: frame.Navigate(typeof(SamplePage2)); break; case 2: frame.Navigate(typeof(SamplePage3)); break; } newItem.Content = frame; return(newItem); }
public NavigationRootPage() { InitializeComponent(); Loaded += delegate { controlsSearchBox.Focus(); }; Current = this; RootFrame = rootFrame; SetStartPage(); if (_startPage != null) { PagesList.SelectedItem = PagesList.Items.OfType <ControlInfoDataItem>().FirstOrDefault(x => x.PageType == _startPage); } NavigateToSelectedPage(); if (Debugger.IsAttached) { DebugMenuItem.Visibility = Visibility.Visible; } }