public void CreateTabItem(string title, Project project, TabControl tabControl) { TabItem tabItem = new TabItem(); tabItem.Header = title; TabGrid = new Grid(); tabItem.Content = TabGrid; drawTT = new DrawTaskTree(TabGrid, project); nv = new Navigation.Navigator(TabGrid); drawCM = new DrawContextMenu(); CreateButtons(); SetLabelProperties(); tabItem.ContextMenu = drawCM.contextMenuForTabItems; tabControl.Items.Add(tabItem); tabItem.Focus(); }
public DrawTaskTree(Grid grid, Project project) { treeView = new TreeView(); HierarchicalDataTemplate hdt = new HierarchicalDataTemplate(); FrameworkElementFactory textBlock = new FrameworkElementFactory(typeof(TextBlock)); textBlock.SetBinding(TextBlock.TextProperty, new Binding("TaskName")); hdt.ItemsSource = new Binding("Children"); drawCM = new DrawContextMenu(); textBlock.SetValue(TextBlock.ContextMenuProperty, drawCM.contextMenuForTasks); hdt.VisualTree = textBlock; treeView.ItemTemplate = hdt; treeView.ItemsSource = project.Root; Thickness margin = treeView.Margin; margin.Top = 10; margin.Right = 1000; margin.Bottom = 10; treeView.Margin = margin; CreateTaskTree(grid); }