/// <summary>
        /// Commits the drag &amp; drop transaction.
        /// </summary>
        /// <param name="dropZoneName">Dropzone name that is the source of the drag operation.</param>
        /// <returns>A task that represents the asynchronous operation.</returns>
        public async Task CommitTransaction(string dropZoneName)
        {
            await transaction.Commit();

            await ItemDropped.InvokeAsync(new DraggableDroppedEventArgs <TItem>(transaction.Item, dropZoneName));

            TransactionEnded?.Invoke(this, EventArgs.Empty);

            transaction = null;
        }
Example #2
0
        public async Task CommitTransaction(string dropzoneIdentifier, bool reorderIsAllowed)
        {
            await _transaction.Commit();

            var index = -1;

            if (reorderIsAllowed == true)
            {
                index = GetTransactionIndex() + 1;
                if (_transaction.SourceZoneIdentifier == _transaction.CurrentZone && IsItemMovedDownwards() == true)
                {
                    index -= 1;
                }
            }

            await ItemDropped.InvokeAsync(new MudItemDropInfo <T>(_transaction.Item, dropzoneIdentifier, index));

            TransactionEnded?.Invoke(this, new MudDragAndDropTransactionFinishedEventArgs <T>(dropzoneIdentifier, true, _transaction));
            _transaction = null;
        }