public ITabGroupService Create(TabGroupServiceOptions options = null) { var mgr = new TabGroupService(this, menuService, wpfFocusService, options); tabGroupServices.Add(mgr); if (selectedIndex < 0) { selectedIndex = 0; } return(mgr); }
public TabGroupService(TabService tabService, IMenuService menuService, IWpfFocusService wpfFocusService, TabGroupServiceOptions options) { this.options = (options ?? new TabGroupServiceOptions()).Clone(); stackedContent = new StackedContent <TabGroup>(); tabSelectionChanged = new WeakEventList <TabSelectedEventArgs>(); tabGroupSelectionChanged = new WeakEventList <TabGroupSelectedEventArgs>(); tabGroupCollectionChanged = new WeakEventList <TabGroupCollectionChangedEventArgs>(); this.tabService = tabService; this.menuService = menuService; this.wpfFocusService = wpfFocusService; _activeIndex = -1; }
public TabGroup(TabGroupService tabGroupService, IMenuService menuService, IWpfFocusService wpfFocusService, TabGroupServiceOptions options) { this.options = options; this.tabContentAttached = new WeakEventList <TabContentAttachedEventArgs>(); this.tabGroupService = tabGroupService; this.wpfFocusService = wpfFocusService; this.tabControl = new TabControl(); this.tabControl.DataContext = this; this.tabControl.SetStyle(options.TabControlStyle ?? "FileTabGroupTabControlStyle"); this.tabControl.SelectionChanged += TabControl_SelectionChanged; this.tabControl.PreviewKeyDown += TabControl_PreviewKeyDown; if (options.InitializeContextMenu != null) { this.contextMenuProvider = options.InitializeContextMenu(menuService, this, this.tabControl); } else if (options.TabGroupGuid != Guid.Empty) { this.contextMenuProvider = menuService.InitializeContextMenu(this.tabControl, options.TabGroupGuid, new GuidObjectsProvider(this)); } }