public static void DeletePage(HelpDocFrame page) { foreach (var item in new List <HelpDocFrame>(TabItemCollection)) { if (item.PageIndex == page.PageIndex) { TabItemCollection.Remove(item); } } }
public static void CollectPage(HelpDocFrame page) { foreach (var item in TabItemCollection) { if (item.PageIndex == page.PageIndex) { return; } } TabItemCollection.Add(page); }
public void CloseItem(HelpDocFrame item) { if (TabItemCollection.Contains(item)) { oldStatus = GetCurrentStatus(); if (item == SelectedItem) { SelectedIndex = 0; } TabItemCollection.Remove(item); item.IsUsed = false; PageTabControlStatusChanged.Invoke(new PageTabControlStatusChangedEventArgs(oldStatus)); } }
public void ShowItem(HelpDocFrame item) { oldStatus = GetCurrentStatus(); if (!TabItemCollection.Contains(item)) { TabItemCollection.Add(item); item.IsUsed = true; } if (SelectedItem != item) { SelectedItem = item; PageTabControlStatusChanged.Invoke(new PageTabControlStatusChangedEventArgs(oldStatus)); } }
private void OnTabItemHeaderCancelButtonClick(object sender, RoutedEventArgs e) { Button button = sender as Button; if (button != null) { TabItem tabitem = button.TemplatedParent as TabItem; if (tabitem != null) { HelpDocFrame tab = tabitem.Content as HelpDocFrame; if (tab != null) { MainTab.CloseItem(tab); } } } }
private void OnTabItemHeaderMouseDown(object sender, MouseButtonEventArgs e) { if (e.MiddleButton == MouseButtonState.Pressed) { Grid grid = sender as Grid; if (grid != null) { TabItem tabitem = grid.TemplatedParent as TabItem; if (tabitem != null) { HelpDocFrame tab = tabitem.Content as HelpDocFrame; if (tab != null) { MainTab.CloseItem(tab); } } } } }
public void InitializeTabItemCollection(HelpDocFrame item) { TabItemCollection.Add(item); item.IsUsed = true; SelectedItem = item; }