I am actually trying to do a graph whit given points, the things is that I donot know how can I drag one of the m to put it into a desired place. If anyone could help me please, I would be so grateful
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sandhiya PriyaPosted Jan 2, 2026, 11:14 AM
In WPF, points on a graph are not draggable by default. You must handle mouse events and update the point’s position manually.
Simple idea to make a point draggable in WPF:
Draw points using a
Canvas(best for absolute positioning)Capture mouse events (
MouseDown,MouseMove,MouseUp)Update the point’s
Canvas.LeftandCanvas.Topwhile draggingBasic approach:
On
MouseDown? start draggingOn
MouseMove? change the point positionOn
MouseUp? stop draggingExample (Ellipse as a draggable point):
points to remember:
Use
Canvasfor graph plottingEach point (Ellipse) can be dragged independently
Update coordinates to redraw lines if the graph is connected
This is the standard and recommended way to drag graph points in WPF.