コード例 #1
0
        private bool HandleDrag(DragNDropEventArgs e)
        {
            Debug.WriteLine($"X : {e.X} Y : {e.Y}");
            // XamlDraggableView.TranslationX = e.X / 1080 * _Width;
            // XamlDraggableView.TranslationY = e.Y / 1920 * _Height;

            switch (e.Action)
            {
            case DragNDropEventArgs.DragAction.Started:
                return(true);

            case DragNDropEventArgs.DragAction.Entered:
                return(true);

            case DragNDropEventArgs.DragAction.Updated:
                return(true);

            case DragNDropEventArgs.DragAction.Exited:
                return(true);

            case DragNDropEventArgs.DragAction.Ended:
                return(true);

            case DragNDropEventArgs.DragAction.Dropped:
                SetViewInContainer(e.HoveredView);
                return(true);

            default:
                return(true);
            }
        }
コード例 #2
0
        private DropOperation HandleDropProposal(DragNDropEventArgs e)
        {
            // this is called while there's a view hovering the container

            // define whether we want to allow or forbid the drop in this container using the arguments
            Debug.WriteLine($"X : {e.X} Y : {e.Y}");
            return(DropOperation.Copy); // testing
        }