开发者

Drag & Drop WPF-object inside boundaries

I want to create a user-control where I can move an object (like a rectangle) within certain boundaries via drag & drop.

The 开发者_如何学Cdrag shall be limited to the x-axis only (think of a slider).

How do I do this?


You can make use of Canvas as a base control and then add any number of WPF control to the base Canvas. Then capture the MouseX position and reset the selected child control's Left position using Canvas.SetLeft when user click and drag the control.

Here is one good article link which will help you get started.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜