private ContentTabItem CreateContentTabItem() { ContentTabItem tabItem = new ContentTabItem(); if (this.ContentTabHeaderContent != null) { tabItem.Header = this.ContentTabHeaderContent; } else { FabTabResources rd = new FabTabResources(); tabItem.Header = rd.DefaultContentTabHeader; } return(tabItem); }
private void UpdateContentsTabDropdown() { ContentTabItem contentTab = this.ItemContainerGenerator.ContainerFromIndex(0) as ContentTabItem; if (contentTab != null) { contentTab.ApplyTemplate(); _contentsTabComboBox = contentTab.Template.FindName("PART_tabHeaderComboBox", contentTab) as ComboBox; _contentsTabComboBox.SelectionChanged -= new SelectionChangedEventHandler(combo_SelectionChanged); _contentsTabComboBox.Items.Clear(); if (_contentsTabComboBox != null) { this.Items.ForEach(AddFabTabItemHeaderIntoContentTabDropDown); //now wire up to the combo to select tabs _contentsTabComboBox.SelectionChanged += new SelectionChangedEventHandler(combo_SelectionChanged); } } }
protected override DependencyObject GetContainerForItemOverride() { //Added some extra _contentTabview stuff in this method in the if conditional //as well as nulling it out outside of the if conditional. Also had to //null out _contentTabView in OnSelectionChanged. All these changes were necessary //because of some differing behavior in .NET 4.0 beta for when IsItemsItsOwnContainer //gets called which caused me state issues with_contentTabView. if (_itemsStrategy == null) { SetupItemsStrategy(); } if (_contentTabView != null) { ContentTabItem tabItem = CreateContentTabItem(); _contentTabView = null; return(tabItem); } return(CreateNewFabTabItemAndWireUpClosingEvent()); }
// This Panel lays its children out horizontally. // If all children cannot fit in the allocated space, // the available space is divided proportionally between them. protected override Size MeasureOverride(Size availableSize) { if (!this.AllowMultiLineTabHeaders) { // See how much room the children want double width = 0.0; this._rowHeight = 0.0; foreach (UIElement element in this.Children) { element.Measure(availableSize); Size size = this.GetDesiredSizeLessMargin(element); this._rowHeight = Math.Max(this._rowHeight, size.Height); width += size.Width; } // If not enough room, scale the // children to the available width if (width > availableSize.Width) { ContentTabItem contentTabItem = this.Children[0] as ContentTabItem; if (contentTabItem != null) { //there's a content tab, we don't want to narrow it, so take that into account in calculating //the scalefactor this._scaleFactor = (availableSize.Width - contentTabItem.DesiredSize.Width) / width; } else { //scale factor calculated based upon all tabs, there's no contenttab whose width //we want to preserve this._scaleFactor = availableSize.Width / width; } width = 0.0; foreach (UIElement element in this.Children) { if (!(element is ContentTabItem) && (!(element as TabItem).IsSelected)) { element.Measure(new Size(element.DesiredSize.Width * this._scaleFactor, availableSize.Height)); } else { //give the full width to the ContentTab and the currently selected tab element.Measure(new Size(element.DesiredSize.Width, availableSize.Height)); } width += element.DesiredSize.Width; } } else { this._scaleFactor = 1.0; } return(new Size(width, this._rowHeight)); } else { return(base.MeasureOverride(availableSize)); } }
private ContentTabItem CreateContentTabItem() { ContentTabItem tabItem = new ContentTabItem(); if (this.ContentTabHeaderContent != null) { tabItem.Header = this.ContentTabHeaderContent; } else { FabTabResources rd = new FabTabResources(); tabItem.Header = rd.DefaultContentTabHeader; } return tabItem; }