Пример #1
0
    private void OnMouseDown(Event e)
    {
        Image comp = e.Target as Image;

        if (null == comp)
        {
            return;
        }

        // check if dragged item is child of _pnlSource or _pnlDest
        if (_pnlSource.ContentContains(comp) || _pnlDest.ContentContains(comp))
        {
            DragSource dataSource = new DragSource();
            //dataSource.AddData(comp.Text, "text"); // add text for COPY_TEXT mode
            //dataSource.AddData(comp.StyleName, "style"); // add text for COPY_STYLE mode
            //dataSource.AddData(comp, "control"); // add reference to control for Move mode

            Image proxy = new Image
            {
                Texture   = comp.Texture, // reference the same texture
                ScaleMode = ImageScaleMode.ScaleToFit
                                          //// TEMP: handles the DragDropManager missing bounds clonning
                                          //Bounds = (Rectangle) comp.GlobalBounds.Clone(),

                                          //// TEMP: handles the DragDropManager missing MouseEnabled enabled turning off on the proxy
                                          //MouseEnabled = false
            };

            DragDropManager.DoDrag(comp, dataSource, (MouseEvent)e, proxy, 0, 0, 0.5f, false);

            /*new DragOption(DragOptionType.ProxyVisible, false),
             * new DragOption(DragOptionType.FeedbackVisible, false)*/
        }
    }