示例#1
0
        internal override void OnOrientationChanged(Orientation newValue)
        {
            base.OnOrientationChanged(newValue);

            if (this.owner == null || !this.owner.IsTemplateApplied)
            {
                return;
            }

            if (this.owner.GetItemCount() > 0)
            {
                this.owner.StopAllAddedAnimations();
                this.owner.StopAllRemovedAnimations();

                IDataSourceItem firstViewportItem = this.GetTopVisibleContainer().associatedDataItem;
                while (this.owner.realizedItems.Count > 0)
                {
                    RadDataBoundListBoxItem lastItem = this.owner.realizedItems[this.owner.realizedItems.Count - 1] as RadDataBoundListBoxItem;
                    lastItem.SetVerticalOffset(0);
                    lastItem.SetHorizontalOffset(0);
                    this.owner.RecycleLastItem();
                }

                this.owner.initialVirtualizationItem = firstViewportItem;
                this.owner.BeginAsyncBalance();
                this.owner.BalanceVisualSpace();
            }
        }
        private void UpdateContainerVisualState(DataSourceItem item)
        {
            RadDataBoundListBoxItem container = this.owner.GetContainerFromDataSourceItem(item) as RadDataBoundListBoxItem;

            if (container != null)
            {
                container.UpdateCheckedState();
            }
        }
示例#3
0
        private void OnItemReorderStateChanged(bool isActive, RadDataBoundListBoxItem targetItem)
        {
            EventHandler <ItemReorderStateChangedEventArgs> eh = this.ItemReorderStateChanged;

            if (eh != null)
            {
                eh(this, new ItemReorderStateChangedEventArgs(isActive, targetItem));
            }
        }
        internal virtual bool IsItemCheckable(RadDataBoundListBoxItem item)
        {
            if (item.associatedDataItem == RadDataBoundListBox.ListHeaderIndicator ||
                item.associatedDataItem == RadDataBoundListBox.ListFooterIndicator ||
                item.associatedDataItem == RadDataBoundListBox.IncrementalLoadingIndicator)
            {
                return(false);
            }

            return(true);
        }
        internal virtual bool IsCheckModeArea(RadDataBoundListBoxItem item, UIElement container, Point hitPoint)
        {
            if (!ElementTreeHelper.IsElementRendered(item) || !ElementTreeHelper.IsElementRendered(container as FrameworkElement))
            {
                return(false);
            }

            Point relativeOffset = container.TransformToVisual(item).TransformPoint(new Point(0, 0));

            hitPoint = new Point(relativeOffset.X + hitPoint.X, relativeOffset.Y + hitPoint.Y);
            return(item.IsPointInCheckModeAreaForItem(hitPoint));
        }
示例#6
0
        internal virtual void OnItemMouseHold(RadDataBoundListBoxItem item)
        {
            if (!this.isItemReorderEnabledCache || !this.IsItemReorderSupported)
            {
                return;
            }

            if (item.associatedDataItem.Value == null || this.listSource.FindItem(item.associatedDataItem.Value) == null)
            {
                return;
            }

            this.StartItemReorderForItem(item);
        }
        /// <summary>
        /// Handles check toggle request from a child visual item.
        /// </summary>
        internal virtual void HandleItemCheckStateChange(RadDataBoundListBoxItem item)
        {
            if (this.checkedItems.IsReadOnly)
            {
                return;
            }

            if (!item.IsChecked)
            {
                this.AddCheckedItem(item.associatedDataItem as DataSourceItem);
            }
            else
            {
                this.RemoveCheckedItem(item.associatedDataItem as DataSourceItem);
            }
        }
        internal void ShowCheckboxesPressIndicator(RadDataBoundListBoxItem targetItem)
        {
            if (this.indicatorVisible)
            {
                return;
            }

            this.indicatorVisible = true;
            Rect coordinates = targetItem.GetCheckBoxesIndicatorRectangleForItem(this.checkBoxesPressIndicator.Margin);

            this.checkBoxesPressIndicator.Height = coordinates.Height;
            this.checkBoxesPressIndicator.Width  = coordinates.Width;
            this.indicatorTranslate.Y            = coordinates.Y;
            this.indicatorTranslate.X            = coordinates.X;
            this.checkBoxesIndicatorAnimation.To = 1.0;
            this.checkBoxesIndicatorStoryboard.Begin();
        }
示例#9
0
        internal void StartItemReorderForItem(RadDataBoundListBoxItem item)
        {
            this.UnsubscribeRendering();

            this.itemReorderControl.targetItem = item;

            foreach (RadVirtualizingDataControlItem container in this.realizedItems)
            {
                if (container != item)
                {
                    VisualStateManager.GoToState(container, "ItemOrdered", false);
                }
            }

            this.itemReorderPopup.IsOpen = true;
            this.itemReorderControl.EvaluateButtonsAvailability();
        }
示例#10
0
        /// <summary>
        /// Toggles the Item Reorder popup on or off according to the argument's value.
        /// </summary>
        /// <param name="pivotItem">The visual container which will be used as a pivot item to start the reordering.</param>
        public void ActivateItemReorderForItem(RadDataBoundListBoxItem pivotItem)
        {
            if (!this.IsProperlyTemplated)
            {
                return;
            }

            if (!this.IsItemReorderSupported)
            {
                return;
            }

            if (this.itemReorderPopup.IsOpen)
            {
                return;
            }

            this.StartItemReorderForItem(pivotItem);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ItemReorderStateChangedEventArgs"/> class.
 /// </summary>
 /// <param name="isActive">If set to <c>true</c> [is active].</param>
 /// <param name="container">The container.</param>
 internal ItemReorderStateChangedEventArgs(bool isActive, RadDataBoundListBoxItem container)
 {
     this.IsReorderActive = isActive;
     this.PivotItem       = container;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ListBoxItemTapEventArgs"/> class.
 /// </summary>
 /// <param name="item">The item.</param>
 /// <param name="manipulationContainer">The container of the item.</param>
 /// <param name="originalSource">The element from which the manipulation originates.</param>
 /// <param name="manipulationOrigin">The point at which the item was tapped.</param>
 public ListBoxItemTapEventArgs(RadDataBoundListBoxItem item, UIElement manipulationContainer, UIElement originalSource, Point manipulationOrigin)
     : this(item, manipulationContainer, manipulationOrigin)
 {
     this.originalSource = originalSource;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ListBoxItemTapEventArgs"/> class.
 /// </summary>
 /// <param name="item">The item.</param>
 /// <param name="manipulationContainer">The container of the item.</param>
 /// <param name="manipulationOrigin">The point at which the item was tapped.</param>
 public ListBoxItemTapEventArgs(RadDataBoundListBoxItem item, UIElement manipulationContainer, Point manipulationOrigin)
 {
     this.item = item;
     this.manipulationOrigin    = manipulationOrigin;
     this.manipulationContainer = manipulationContainer;
 }
        private void ReorderViewportItemsStartingAtRow(WrapRow row)
        {
            WrapRow parentRow = row;
            RadDataBoundListBoxItem processedItem = parentRow.firstItem as RadDataBoundListBoxItem;

            parentRow.lastItem    = processedItem;
            processedItem.wrapRow = parentRow;
            parentRow.rowOffset   = this.GetRowOffset(parentRow);
            double currentRowPosition = 0;

            while (true)
            {
                this.SetItemOffset(processedItem, parentRow.rowOffset);
                processedItem.wrapRow = parentRow;
                switch (this.orientationCache)
                {
                case Orientation.Horizontal:
                    processedItem.SetHorizontalOffset(currentRowPosition);
                    break;

                case Orientation.Vertical:
                    processedItem.SetVerticalOffset(currentRowPosition);
                    break;
                }

                currentRowPosition += this.GetItemExtent(processedItem);
                double itemLength = this.GetItemLength(processedItem);
                if (itemLength > parentRow.rowLength)
                {
                    parentRow.rowLength = itemLength;
                }
                processedItem = processedItem.next as RadDataBoundListBoxItem;

                if (processedItem == null)
                {
                    int wrapRowsCount = this.wrapRows.Count;
                    this.OnRowFilled(parentRow, true);
                    while (this.lastWrapRow != parentRow)
                    {
                        int indexOfRowToRemove = --wrapRowsCount;
                        this.RemoveWrapRowAt(indexOfRowToRemove);
                    }
                    break;
                }
                else if (!this.CheckEnoughSpaceForItemInRow(parentRow, processedItem, true))
                {
                    parentRow.lastItem = processedItem.previous;
                    currentRowPosition = 0;
                    this.OnRowFilled(parentRow, false);

                    if (parentRow.next == null)
                    {
                        parentRow = this.InsertWrapRowAt(this.wrapRows.Count);
                    }
                    else
                    {
                        parentRow = parentRow.next;
                    }

                    parentRow.rowOffset = this.GetRowOffset(parentRow);
                    parentRow.firstItem = processedItem;
                    parentRow.lastItem  = processedItem;
                    parentRow.rowLength = this.GetItemLength(processedItem);
                }
                else
                {
                    parentRow.lastItem = processedItem;
                }
            }
        }