/// <summary> /// Returns the ordinal position in the set for the element that is associated with the automation peer. /// </summary> /// <returns> /// The ordinal position in the set. /// </returns> protected override int GetPositionInSetCore() { int positionInSet = base.GetPositionInSetCore(); if (positionInSet != -1) { return(positionInSet); } CarouselItem owner = this.OwnerCarouselItem; Carousel parent = owner.ParentCarousel; positionInSet = parent.IndexFromContainer(owner) + 1; return(positionInSet); }