public void CreateTabFor(string header, ImageSource icon, bool allowDelete, IViewPlugin viewPlugin, UIElement viewElement, object dataInstance, WellKnownView view, bool select) { // If allowdelete = false, we also hide the header var newTab = new TabItem { Header = header, Icon = icon, AllowDelete = allowDelete, ShowHeader = allowDelete, Tag = viewPlugin, WellKnownView = view }; if (viewElement != null) { newTab.Content = viewElement; } if (newTab.Content is IControllableTab) { IControllableTab tab = (IControllableTab)newTab.Content; // Create a textblock and bind it to the header property of the tab slave TextBlock tb = new TextBlock(); tb.SetBinding(TextBlock.TextProperty, new Binding("Title") { Source = tab }); newTab.Header = tb; // Attach the RequestCloseTab event tab.RequestCloseTab += delegate { TabHost.RemoveItem(newTab); }; TabHost.HeaderContent = tab.CustomHeaderContent; } if (newTab.Content is IPersistableTab) { Debug.Assert(dataInstance != null, "Data instance can not be null"); IPersistableTab tab = (IPersistableTab)newTab.Content; tab.LoadData(dataInstance); } TabHost.Items.Add(newTab); if (select) { TabHost.SelectedItem = newTab; } }
public void CreateTabFor(string header, ImageSource icon, bool allowDelete, IViewPlugin viewPlugin, UIElement viewElement, object dataInstance, WellKnownView view, bool select) { // If allowdelete = false, we also hide the header var newTab = new TabItem { Header = header, Icon = icon, AllowDelete = allowDelete, ShowHeader = allowDelete, Tag = viewPlugin, WellKnownView = view }; if (viewElement != null) { newTab.Content = viewElement; } if (newTab.Content is IControllableTab) { IControllableTab tab = (IControllableTab) newTab.Content; // Create a textblock and bind it to the header property of the tab slave TextBlock tb = new TextBlock(); tb.SetBinding(TextBlock.TextProperty, new Binding("Title") { Source = tab }); newTab.Header = tb; // Attach the RequestCloseTab event tab.RequestCloseTab += delegate { TabHost.RemoveItem(newTab); }; TabHost.HeaderContent = tab.CustomHeaderContent; } if (newTab.Content is IPersistableTab) { Debug.Assert(dataInstance != null, "Data instance can not be null"); IPersistableTab tab = (IPersistableTab) newTab.Content; tab.LoadData(dataInstance); } TabHost.Items.Add(newTab); if (select) TabHost.SelectedItem = newTab; }
public TabItemEventArgs(TabItem item) { _item = item; }
public TabItemCancelEventArgs(TabItem item) : base() { _item = item; }