// This constructor defines the look of the "new tab", which displays all apps for a user to choose from. public SideBar(SurfaceWindow1 surfaceWindow, TabControl tabBar) { savedPages = new List<SavedPage>(); this.surfaceWindow = surfaceWindow; this.tabBar = tabBar; tabItems = new List<SideBarTab>(); tabAdd = new SideBarTab(this); tabAdd.Header = "+"; tabAdd.Width = 50; tabAdd.FontSize = 25; tabAdd.FontFamily = new FontFamily("Cambria"); Canvas newTabCanvas = new Canvas(); newTabCanvas.Height = 900; newTabCanvas.Width = 550; tabAdd.Content = newTabCanvas; newTabCanvas.Children.Add(addApplication("Search", "search.png", SearchButton_Selected, 100, 290, true)); newTabCanvas.Children.Add(addApplication("Annotate", "pencil.png", AnnotateButton_Selected, 100, 480, false)); newTabCanvas.Children.Add(addApplication("Saved Pages", "save.png", SavedPagesButton_Selected, 320, 480, false)); newTabCanvas.Children.Add(addApplication("Music", "music.png", StudyButton_Selected, 320, 290, true)); tabItems.Add(tabAdd); tabBar.DataContext = tabItems; tabBar.SelectedIndex = 0; }
/** * Opening a new AnnotationTab. * NOTE: The annotation tab has not been implemented yet. * This method will open a blank tab with the annotation icon in its header. * */ private void AnnotateButton_Selected(object sender, RoutedEventArgs e) { tabBar.DataContext = null; SideBarTab newTab = new SideBarTab(this); int count = tabItems.Count; newTab.HeaderTemplate = tabBar.FindResource("NewAnnotateTab") as DataTemplate; tabItems.Insert(count - 1, newTab); tabBar.DataContext = tabItems; tabBar.SelectedItem = newTab; }