Ejemplo n.º 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();
            }
        }
Ejemplo n.º 2
0
 public ListBoxItemTapEventArgs(RadDataBoundListBoxItem item, UIElement container, UIElement originalSource, Point hitPoint, object SelectedItem)
 {
     Item           = item;
     Container      = container;
     OriginalSource = originalSource;
     HitPoint       = hitPoint;
     TappedItem     = SelectedItem;
 }
        private void OnItemReorderStateChanged(bool isActive, RadDataBoundListBoxItem targetItem)
        {
            EventHandler <ItemReorderStateChangedEventArgs> eh = this.ItemReorderStateChanged;

            if (eh != null)
            {
                eh(this, new ItemReorderStateChangedEventArgs(isActive, targetItem));
            }
        }
Ejemplo n.º 4
0
        private void UpdateContainerVisualState(DataSourceItem item)
        {
            RadDataBoundListBoxItem container = this.owner.GetContainerFromDataSourceItem(item) as RadDataBoundListBoxItem;

            if (container != null)
            {
                container.UpdateCheckedState();
            }
        }
        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);
            }

            ////return this.typedStrategy.IsPointInCheckModeAreaForItem(item, container, hitPoint);
            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));
        }
        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 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();
        }
        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();
        }
        /// <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);
        }
Ejemplo n.º 12
0
        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;
                }
            }
        }
Ejemplo n.º 13
0
 /// <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;
 }