Beispiel #1
0
        protected int EnsureItemToChildIndex(int itemIndex)
        {
            RadElement element = (RadElement)this.items.GetVirtualData(itemIndex);

            int childIndex = this.Children.IndexOf(element);

            if (childIndex != -1)
            {
                return(childIndex);
            }
            CarouselContentItem childContainer = new CarouselContentItem(element);

            childContainer.SetOwner(this.owner);
            childContainer.AddBehavior(this.carouselItemBehavior);
            this.CarouselPath.InitializeItem(childContainer, this.AnimationsApplied);
            this.Children.Add(childContainer);

//#if Marker
//            RadButtonElement e = element as RadButtonElement;
//            if (e != null && e.Tag != null)
//            {
//                int i = (int)e.Tag;
//                CarouselPathAnimationData data = GetItemAnimationData(this.Children.Count - 1);
//                data.marker = i;
//            }
//#endif

            return(this.Children.Count - 1);
        }
        protected int EnsureItemToChildIndex(int itemIndex)
        {
            RadElement virtualData = (RadElement)this.items.GetVirtualData(itemIndex);
            int        num         = this.Children.IndexOf(virtualData);

            if (num != -1)
            {
                return(num);
            }
            CarouselContentItem carouselContentItem = new CarouselContentItem(virtualData);

            carouselContentItem.SetOwner(this.owner);
            carouselContentItem.AddBehavior((PropertyChangeBehavior)this.carouselItemBehavior);
            this.CarouselPath.InitializeItem((VisualElement)carouselContentItem, (object)this.AnimationsApplied);
            this.Children.Add((RadElement)carouselContentItem);
            return(this.Children.Count - 1);
        }
        private void ApplyValuePath(VisualElement element, Point3D newPoint, Animations flags, Size controlSize)
        {
            if (newPoint == null)
            {
                return;
            }

            newPoint = this.ConvertPointIfRelative(newPoint, controlSize);
            SetElementBounds(element, (Point)newPoint, flags);

            double opacityValue      = 1.0;
            CarouselContentItem item = (CarouselContentItem)element;

            switch (item.Owner.ItemsContainer.OpacityChangeCondition)
            {
            case OpacityChangeConditions.None:
                opacityValue = 1.0;
                break;

            case OpacityChangeConditions.ZIndex:
                if (((Point3D)this.FinalPathPoint).Z != 0.0)
                {
                    opacityValue = 1 - (newPoint.Z / ((Point3D)this.FinalPathPoint).Z);
                }
                break;

            case OpacityChangeConditions.SelectedIndex:
                int i = item.Owner.ItemsContainer.Items.IndexOf((RadItem)item.HostedItem);
                opacityValue = 1 - Math.Abs((double)(i - item.Owner.SelectedIndex) / item.Owner.ItemsContainer.VisibleItemCount);
                break;
            }

            if (opacityValue < item.Owner.ItemsContainer.MinFadeOpacity)
            {
                opacityValue = item.Owner.ItemsContainer.MinFadeOpacity;
            }
            else if (opacityValue > 1.0)
            {
                opacityValue = 1.0;
            }

            SetElementOpacity(element, opacityValue, flags);
            SetElementScale(element, ElementScale(newPoint, 1.0), flags);
            SetElementZIndex(element, newPoint, flags);
        }
        private void ApplyValuePath(
            VisualElement element,
            Point3D newPoint,
            Animations flags,
            Size controlSize)
        {
            if (newPoint == null)
            {
                return;
            }
            newPoint = this.ConvertPointIfRelative(newPoint, controlSize);
            CarouselParameterPath.SetElementBounds((RadElement)element, (Point)newPoint, flags);
            double num = 1.0;
            CarouselContentItem carouselContentItem = (CarouselContentItem)element;

            switch (carouselContentItem.Owner.ItemsContainer.OpacityChangeCondition)
            {
            case OpacityChangeConditions.None:
                num = 1.0;
                break;

            case OpacityChangeConditions.SelectedIndex:
                num = 1.0 - Math.Abs((double)(carouselContentItem.Owner.ItemsContainer.Items.IndexOf((RadItem)carouselContentItem.HostedItem) - carouselContentItem.Owner.SelectedIndex) / (double)carouselContentItem.Owner.ItemsContainer.VisibleItemCount);
                break;

            case OpacityChangeConditions.ZIndex:
                if (((Point3D)this.FinalPathPoint).Z != 0.0)
                {
                    num = 1.0 - newPoint.Z / ((Point3D)this.FinalPathPoint).Z;
                    break;
                }
                break;
            }
            if (num < carouselContentItem.Owner.ItemsContainer.MinFadeOpacity)
            {
                num = carouselContentItem.Owner.ItemsContainer.MinFadeOpacity;
            }
            else if (num > 1.0)
            {
                num = 1.0;
            }
            CarouselParameterPath.SetElementOpacity((RadElement)element, num, flags);
            CarouselParameterPath.SetElementScale((RadElement)element, this.ElementScale(newPoint, 1.0), flags);
            this.SetElementZIndex((RadElement)element, newPoint, flags);
        }