public virtual int Compare(object x, object y)
        {
            int ix = items.IndexOf(x as RadItem);
            int iy = items.IndexOf(y as RadItem);

            if (ix != -1 && iy != -1)
            {
                return(ix.CompareTo(iy));
            }
            else
            {
                if (ix == -1 && iy != -1)
                {
                    return(1);
                }
                else if (ix != -1 && iy == -1)
                {
                    return(-1);
                }
                else
                {
                    return(0);
                }
            }
        }
示例#2
0
        private void ItemsChanged(
            RadItemCollection changed,
            RadItem target,
            ItemsChangeOperation operation)
        {
            switch (operation)
            {
            case ItemsChangeOperation.Inserted:
                if (changed.IndexOf(target) <= this.currentIndex)
                {
                    ++this.currentIndex;
                }
                target.Visibility = ElementVisibility.Hidden;
                target.NotifyParentOnMouseInput = true;
                break;

            case ItemsChangeOperation.Removing:
                this.removedIndex = changed.IndexOf(target);
                break;

            case ItemsChangeOperation.Removed:
                if (this.removedIndex != this.currentIndex)
                {
                    this.removedIndex = -2;
                    break;
                }
                this.removedIndex = -2;
                this.RemoveAnimations(target);
                if (this.items.Count <= 0)
                {
                    break;
                }
                int index1 = (this.currentIndex + 1) % this.Items.Count;
                this.currentIndex = -2;
                this.Goto(index1);
                break;

            case ItemsChangeOperation.Set:
                bool flag = changed.IndexOf(target) == this.currentIndex;
                target.Visibility = flag ? ElementVisibility.Visible : ElementVisibility.Hidden;
                target.NotifyParentOnMouseInput = true;
                break;

            case ItemsChangeOperation.Clearing:
                for (int index2 = 0; index2 < this.Items.Count; ++index2)
                {
                    this.RemoveAnimations(this.Items[index2]);
                }
                if (this.defaultItem != null)
                {
                    this.currentIndex           = -1;
                    this.defaultItem.Visibility = ElementVisibility.Visible;
                    break;
                }
                this.currentIndex = -2;
                break;
            }
        }
示例#3
0
        private void ItemsChanged(RadItemCollection changed, RadItem target, ItemsChangeOperation operation)
        {
            bool isCurrent;

            switch (operation)
            {
            case ItemsChangeOperation.Inserted:

                int newIndex = changed.IndexOf(target);
                if (newIndex <= currentIndex)
                {
                    currentIndex++;
                }

                target.Visibility = ElementVisibility.Hidden;
                target.NotifyParentOnMouseInput = true;
                break;

            case ItemsChangeOperation.Set:
                isCurrent = changed.IndexOf(target) == currentIndex;

                target.Visibility = isCurrent ? ElementVisibility.Visible : ElementVisibility.Hidden;
                target.NotifyParentOnMouseInput = true;
                break;

            case ItemsChangeOperation.Removing:
                removedIndex = changed.IndexOf(target);

                break;

            case ItemsChangeOperation.Removed:

                if (removedIndex != currentIndex)
                {
                    removedIndex = -2;
                    break;
                }

                removedIndex = -2;

                this.RemoveAnimations(target);

                if (this.items.Count > 0)
                {
                    int next = (currentIndex + 1) % this.Items.Count;
                    currentIndex = -2;
                    this.Goto(next);
                }

                break;

            case ItemsChangeOperation.Clearing:
                for (int i = 0; i < this.Items.Count; i++)
                {
                    this.RemoveAnimations(this.Items[i]);
                }

                if (defaultItem != null)
                {
                    currentIndex           = -1;
                    defaultItem.Visibility = ElementVisibility.Visible;
                }
                else
                {
                    currentIndex = -2;
                }

                break;
            }
        }