This is a migrated thread and some comments may be shown as answers.

RadPanels Drag and Drop

1 Answer 45 Views
Panelbar (obsolete as of Q2 2010)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
R
Top achievements
Rank 1
R asked on 30 Jun 2008, 10:55 AM
Hi.

I have a  RadPanel with several RadPanels inside. I want to be able to drag and drop the RadPanels to change their location inside the main RadPanel. Can you help me with that?

Thanks

1 Answer, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 01 Jul 2008, 12:12 PM
Hello,

Thank you for contacting us.

A possible solution would be to use a descendant class of the RadPanel and override the OnMouseMove method. This behavior is demonstrated in the following code snippet:

    public class MyPanel : RadPanel 
    { 
        Point downPoint; 
 
        protected override void OnMouseDown(MouseEventArgs e) 
        { 
            base.OnMouseDown(e); 
            downPoint = e.Location; 
        } 
 
        protected override void OnMouseMove(MouseEventArgs e) 
        { 
            base.OnMouseMove(e); 
            if (e.Button == MouseButtons.Left) 
            { 
                Point delta = new Point(e.X - downPoint.X, e.Y - downPoint.Y); 
                Console.WriteLine("Delta: x = {0}, y = {1}", delta.X, delta.Y); 
                this.Location = new Point(this.Location.X + delta.X, this.Location.Y + delta.Y); 
            } 
        } 
 
        public override string ThemeClassName 
        { 
            get 
            { 
                return typeof(RadPanel).FullName; 
            } 
            set 
            { 
            } 
        } 
    } 
 


I hope this helps. Do not hesitate to write me if you have any other questions.

Best wishes,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Panelbar (obsolete as of Q2 2010)
Asked by
R
Top achievements
Rank 1
Answers by
Jack
Telerik team
Share this question
or