private void OnDragItemCompleted(DragDropCompletedData completedData)
        {
            if (completedData.DropResult != DataPackageOperation.None)
            {
                var draggedItems = completedData.Items.Cast <CustomItem>();
                foreach (var item in draggedItems)
                {
                    Items.Remove(item);
                }

                listview.AllowDrop = !Items.Any();
            }
        }
示例#2
0
        private static void ConfigureListView(ListViewBase listview, ListViewDropConfiguration configuration)
        {
            listview.DragItemsStarting += (sender, args) =>
            {
                var data = new DragDropStartingData {
                    Data = args.Data, Items = args.Items
                };
                configuration.DragItemsStartingCommand?.Execute(data);
            };

            listview.DragItemsCompleted += (sender, args) =>
            {
                var data = new DragDropCompletedData {
                    DropResult = args.DropResult, Items = args.Items
                };
                configuration.DragItemsCompletedCommand?.Execute(data);
            };
        }
示例#3
0
        private static void ConfigureListView(ListViewBase listview, ListViewDropConfiguration configuration)
        {
            //{[{
            listview.DragItemsStarting += (sender, args) =>
            {
                var data = new DragDropStartingData {
                    Data = args.Data, Items = args.Items
                };
                configuration.DragItemsStartingAction?.Invoke(data);
            };

            listview.DragItemsCompleted += (sender, args) =>
            {
                var data = new DragDropCompletedData {
                    DropResult = args.DropResult, Items = args.Items
                };
                configuration.DragItemsCompletedAction?.Invoke(data);
            };
            //}]}
        }