/// <summary> /// Gets the collection of elements that are represented in the UI Automation tree as immediate /// child elements of the automation peer. /// </summary> /// <returns>The children elements.</returns> protected override IList<AutomationPeer> GetChildrenCore() { Carousel owner = OwningCarousel; ItemCollection items = owner.Items; if (items.Count <= 0) { return null; } List<AutomationPeer> peers = new List<AutomationPeer>(items.Count); for (int i = 0; i < items.Count; i++) { if (owner.ContainerFromIndex(i) is CarouselItem element) { peers.Add(FromElement(element) ?? CreatePeerForElement(element)); } } return peers; }