コード例 #1
0
 private void OnGraphCloseButton_Click(TabItemWithCloseButton sender)
 {
     graphs.Remove(sender.Content as Graph);
     tabs.Remove(sender);
     UpdateTabsDataContext();
     if ((Tabs.SelectedIndex >= tabs.Count || Tabs.SelectedIndex < 0) &&
         (tabs.Count > 0))
     {
         Tabs.SelectedIndex = (tabs.Count - 1);
     }
 }
コード例 #2
0
        public Graph AddTab()
        {
            Graph g = new Graph();
            TabItemWithCloseButton t = new TabItemWithCloseButton();

            t.Content = g;
            t.OnCloseButtonPressed += OnGraphCloseButton_Click;
            graphs.Add(g);
            tabs.Add(t);
            UpdateTabsDataContext();
            return(g);
        }