예제 #1
0
        internal override int IndexFromContainerInner(DependencyObject container)
        {
            if (_isProcessingReorder)
            {
                // When we process a re-ordering, the "attached" indexes (IndexForItemContainerProperty) are known to be valid,
                // but the native (NativePanel) is not (moved item is still at it's original location / index).

                return(base.IndexFromContainerInner(container));
            }

            if (NativePanel != null)
            {
                var selectorItem = container as SelectorItem;
                if (selectorItem == null)
                {
                    return(-1);
                }

                if (selectorItem.LayoutParameters is RecyclerView.LayoutParams)
                {
                    var displayPosition = NativePanel.GetChildLayoutPosition(selectorItem);
                    var index           = ConvertDisplayPositionToIndex(displayPosition);
                    return(index);
                }
            }

            return(base.IndexFromContainerInner(container));
        }
예제 #2
0
        internal override int IndexFromContainerInner(DependencyObject container)
        {
            if (NativePanel != null)
            {
                var selectorItem = container as SelectorItem;
                if (selectorItem == null)
                {
                    return(-1);
                }

                if (selectorItem.LayoutParameters is RecyclerView.LayoutParams)
                {
                    var displayPosition = NativePanel.GetChildLayoutPosition(selectorItem);
                    var index           = ConvertDisplayPositionToIndex(displayPosition);
                    return(index);
                }
            }

            return(base.IndexFromContainerInner(container));
        }