/// <summary> /// Selects or deselects a tab. /// </summary> private void SetSelected(Tab tab, bool selected) { if (tab == null) { return; } tab.IsSelected.Value = selected; if (selected) { // select tab header if it's not selected var tabHeader = TabHeaderList.Content.Find <TabHeader>(x => x.ParentTab == tab, false); if (tabHeader != null && !tabHeader.IsSelected) { TabHeaderList.SelectItem(tabHeader, false); } // object selected _selectedItem = tab.Item.Value; SelectedItem.Value = tab.Item.Value; SelectedTab = tab; if (Items != null) { Items.SetSelected(_selectedItem); } // trigger object selected action if (TabSelected.HasEntries) { TabSelected.Trigger(new TabSelectionActionData { IsSelected = true, TabView = tab, Item = tab.Item.Value }); } } }