Exemple #1
0
 /// <summary>
 /// Invoking Reordering Event if specified
 /// </summary>
 /// <param name="args">ReorderingEventArgs object</param>
 protected void OnReordering(ReorderingEventArgs args)
 {
     if (this.Reordering != null)
     {
         this.Reordering(this, args);
     }
 }
Exemple #2
0
        /// <summary>
        /// Reorder the rows in RadGridView based on the ReorderingEventArgs passed
        /// </summary>
        /// <param name="args">ReorderingEventArgs object</param>
        private void TryReorderRows(ReorderingEventArgs args)
        {
            IList source = args.SourceGrid.ItemsSource as IList;

            if (args.Cancel || source == null || source.IsFixedSize)
            {
                return;
            }
            var newDropIndex = this.RemoveDraggedItems(source, args.DraggedItems, args.DropIndex);

            this.AddDraggedItems(source, args.DraggedItems, newDropIndex);
        }
Exemple #3
0
        /// <summary>
        /// On DropInfo
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnDropInfo(object sender, DragDropEventArgs e)
        {
            //Limit Drop Behavior to GridViewRow
            if (!(e.Options.Source is GridViewRow))
            {
                return;
            }
            var gridView = e.Options.Destination as RadGridView;
            IEnumerable <object> draggedItems = e.Options.Payload as IEnumerable <object>;
            TreeViewDragCue      cue          = e.Options.DragCue as TreeViewDragCue;

            this.HideDropPositionFeedbackPresenter();

            if (e.Options.Status == DragStatus.DropPossible)
            {
                if (gridView != null)
                {
                    //if ((gridView.Items[gridView.Items.Count - 1] as MarketSnapshotPerformanceData).MarketSnapshotPreferenceInfo.EntityName == null)
                    //{
                    //    ContentControl destinationCue = new ContentControl();
                    //    destinationCue.Content = "No Content in Group";
                    //    e.Options.DestinationCue = destinationCue;
                    //}
                    this.UpdateDragCueContent(cue, gridView.Items[gridView.Items.Count - 1], "Move after: ");
                    cue.IsDropPossible = true;
                }
                else
                {
                    cue.IsDropPossible = false;
                }
            }
            else if (e.Options.Status == DragStatus.DropImpossible)
            {
                cue.DragActionContent = null;
                cue.IsDropPossible    = false;
            }
            else if (e.Options.Status == DragStatus.DropComplete)
            {
                ReorderingEventArgs reorderingArgs = new ReorderingEventArgs(gridView, draggedItems, gridView.Items.Count);
                this.OnReordering(reorderingArgs);
                this.TryReorderRows(reorderingArgs);
                this.OnReordered(new ReorderedEventArgs(gridView, draggedItems));
            }
            e.Handled = true;
        }
Exemple #4
0
        /// <summary>
        /// Invoked on GridViewRow drop information
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnGridViewRowDropInfo(object sender, DragDropEventArgs e)
        {
            this.AssociatedObject.ReleaseMouseCapture();
            var senderRow = (GridViewRow)sender;
            var gridView  = senderRow.GridViewDataControl;
            IEnumerable <object> draggedItems = e.Options.Payload as IEnumerable <object>;
            TreeViewDragCue      cue          = e.Options.DragCue as TreeViewDragCue;

            if (e.Options.Status == DragStatus.DropPossible)
            {
                var currentRow = this.AssociatedObject.GetContainerFromDataItem((this.currentDropItem)) as GridViewRow;
                this.UpdateDragCueContent(cue,
                                          currentDropItem,
                                          String.Format("Move {0}: ", Enum.GetName(typeof(DropPosition), this.currentDropPosition)).ToLower(CultureInfo.InvariantCulture));
                this.ShowDropPositionFeedbackPresenter(gridView, currentRow, this.currentDropPosition);
                cue.IsDropPossible = true;
            }
            else if (e.Options.Status == DragStatus.DropImpossible)
            {
                this.HideDropPositionFeedbackPresenter();
                this.ClearDragCueContent(cue);
                cue.IsDropPossible = false;
            }
            else if (e.Options.Status == DragStatus.DropComplete)
            {
                this.HideDropPositionFeedbackPresenter();
                var dropIndex = gridView.Items.IndexOf(this.currentDropItem);
                if (currentDropPosition == DropPosition.After)
                {
                    dropIndex++;
                }
                ReorderingEventArgs reorderingArgs = new ReorderingEventArgs(gridView, draggedItems, dropIndex);
                this.OnReordering(reorderingArgs);
                this.TryReorderRows(reorderingArgs);
                this.OnReordered(new ReorderedEventArgs(gridView, draggedItems));
            }
            e.Handled = true;
        }