// Selected TabItem content is located under the TabControl style visual tree /// protected override List<AutomationPeer> GetChildrenCore() { // Call the base in case we have children in the header List<AutomationPeer> headerChildren = base.GetChildrenCore(); // Only if the TabItem is selected we need to add its visual children TabItem tabItem = GetWrapper() as TabItem; if (tabItem != null && tabItem.IsSelected) { TabControl parentTabControl = ItemsControlAutomationPeer.Owner as TabControl; if (parentTabControl != null) { ContentPresenter contentHost = parentTabControl.SelectedContentPresenter; if (contentHost != null) { AutomationPeer contentHostPeer = new FrameworkElementAutomationPeer(contentHost); List<AutomationPeer> contentChildren = contentHostPeer.GetChildren(); if (contentChildren != null) { if (headerChildren == null) headerChildren = contentChildren; else headerChildren.AddRange(contentChildren); } } } } return headerChildren; }
// Selected TabItem content is located under the TabControl style visual tree /// protected override List <AutomationPeer> GetChildrenCore() { // Call the base in case we have children in the header List <AutomationPeer> headerChildren = base.GetChildrenCore(); // Only if the TabItem is selected we need to add its visual children TabItem tabItem = GetWrapper() as TabItem; if (tabItem != null && tabItem.IsSelected) { TabControl parentTabControl = ItemsControlAutomationPeer.Owner as TabControl; if (parentTabControl != null) { ContentPresenter contentHost = parentTabControl.SelectedContentPresenter; if (contentHost != null) { AutomationPeer contentHostPeer = new FrameworkElementAutomationPeer(contentHost); List <AutomationPeer> contentChildren = contentHostPeer.GetChildren(); if (contentChildren != null) { if (headerChildren == null) { headerChildren = contentChildren; } else { headerChildren.AddRange(contentChildren); } } } } } return(headerChildren); }
/// <summary>Gets the collection of child elements of the <see cref="T:System.Windows.Controls.TabItem" /> that is associated with this <see cref="T:System.Windows.Automation.Peers.TabItemAutomationPeer" />. Called by <see cref="M:System.Windows.Automation.Peers.AutomationPeer.GetChildren" />.</summary> /// <returns>The collection of child elements.</returns> // Token: 0x06002815 RID: 10261 RVA: 0x000BB7A4 File Offset: 0x000B99A4 protected override List <AutomationPeer> GetChildrenCore() { List <AutomationPeer> list = base.GetChildrenCore(); TabItem tabItem = base.GetWrapper() as TabItem; if (tabItem != null && tabItem.IsSelected) { TabControl tabControl = base.ItemsControlAutomationPeer.Owner as TabControl; if (tabControl != null) { ContentPresenter selectedContentPresenter = tabControl.SelectedContentPresenter; if (selectedContentPresenter != null) { AutomationPeer automationPeer = new FrameworkElementAutomationPeer(selectedContentPresenter); List <AutomationPeer> children = automationPeer.GetChildren(); if (children != null) { if (list == null) { list = children; } else { list.AddRange(children); } } } } } return(list); }