public CloseableTabItem(TextBlock header, bool closeable = true) { tabId = Guid.NewGuid(); header.FontSize = 14; header.VerticalAlignment = VerticalAlignment.Center; // Container for header controls var dockPanel = new DockPanel(); dockPanel.Children.Add(header); // Close button to remove the tab if (closeable) { var closeButton = new TabCloseButton(); closeButton.Click += (sender, e) => { TabMgr.CloseTab(tabId); }; dockPanel.Children.Add(closeButton); } Header = dockPanel; }
private void OnCloseBtnClick(object sender, RoutedEventArgs e) { TabMgr.CloseTab(tabId); }