Ejemplo n.º 1
0
        private void ItemsOwner_TileDragEnded(object sender, TileViewDragEventArgs e)
        {
            Mouse.Capture(null);
            (e.DraggedItem as FrameworkElement).ReleaseMouseCapture();
            var columnWidth = this.DesiredSize.Width / this.ColumnsCount;
            var rowHeight   = this.DesiredSize.Height / this.RowsCount;

            var column = (int)(this.lastMousePosition.X / columnWidth);
            var row    = (int)(this.lastMousePosition.Y / rowHeight);
            var item   = e.DraggedItem as RadTileViewItem;

            if (!this.TrySwapTiles(item, this.secondTile))
            {
                var currentRow    = TileViewAttachedProperties.GetRow(item);
                var currentColumn = TileViewAttachedProperties.GetColumn(item);
                var rowSpan       = TileViewAttachedProperties.GetRowSpan(item);
                var columnSpan    = TileViewAttachedProperties.GetColumnSpan(item);
                this.MarkCells(currentRow, currentColumn, rowSpan, columnSpan, false);

                TileViewAttachedProperties.SetColumn(item, column);
                TileViewAttachedProperties.SetRow(item, row);

                this.FixOverlapping(row, column, rowSpan, columnSpan);
            }

            this.secondTile    = null;
            this.isTileDragged = false;
            this.InvalidateMeasure();
        }
Ejemplo n.º 2
0
 private void ItemsOwner_TileDragStarted(object sender, TileViewDragEventArgs e)
 {
     this.isTileDragged = true;
     this.firstTile     = e.DraggedItem as RadTileViewItem;
 }