Beispiel #1
0
        private void UpdateAsymmetry()
        {
            if (null == circularPaginationStyle.IndicatorSize)
            {
                return;
            }
            if (null == circularPaginationStyle.IndicatorImageURL)
            {
                return;
            }

            int listCount = indicatorList.Count;

            for (int i = 0; i < listCount; i++)
            {
                container.RemoveVisual("Indicator" + i);
            }
            container.RemoveAll();
            indicatorList.Clear();

            for (int i = 0; i < listCount; i++)
            {
                ImageVisual newOne = new ImageVisual
                {
                    Size     = new Size2D((int)circularPaginationStyle.IndicatorSize.Width, (int)circularPaginationStyle.IndicatorSize.Height),
                    Position = oddArray[i + (middleIndex - leftIndicatorCount)]
                };

                if (isCenterImageSet && !isSymmetrical && (i == leftIndicatorCount))
                {
                    newOne.URL = circularPaginationStyle.CenterIndicatorImageURL.Normal;
                }
                else
                {
                    newOne.URL = circularPaginationStyle.IndicatorImageURL.Normal;
                }
                newOne.Opacity = 0.5f;
                container.AddVisual("Indicator" + i, newOne);
                indicatorList.Add(newOne);
            }

            // If selectedIndex is not set yet, the default value is middle index.
            if (selectedIndex == -1)
            {
                selectedIndex = leftIndicatorCount;
            }

            if (isCenterImageSet && (selectedIndex == leftIndicatorCount))
            {
                indicatorList[selectedIndex].URL     = circularPaginationStyle.CenterIndicatorImageURL.Selected;
                indicatorList[selectedIndex].Opacity = 1.0f;
            }
            else
            {
                indicatorList[selectedIndex].URL     = circularPaginationStyle.IndicatorImageURL.Selected;
                indicatorList[selectedIndex].Opacity = 1.0f;
            }
        }