Dragging Elements in a Canvas - Online Free Computer Tutorials.

'Software Development, Games Development, Mobile Development, iOS Development, Android Development, Window Phone Development. Dot Net, Window Services,WCF Services, Web Services, MVC, MySQL, SQL Server and Oracle Tutorials, Articles and their Resources

Tuesday, June 12, 2012

Dragging Elements in a Canvas

Well during some development of UI in the office I came across the need to Implement some stupid simple Canvas with the ability to drag some elements in it and around it.

after some Google search i came across the article of Dragging Elements in a Canvas by John Smith, and well it was quite good in its simplicity so i decided to adopt it. an well as the headline says this article is about customizing Canvas Class of WPF so it would be possible to drag a elements within it.

while going through the source of DragCanvasDemo and trying it out some, features were found not to entirely fit for my purposes, such as to much of static DependecyProperties, some not fully finished Calculation for edge states such as if no out of canvas view allowed the before the element will go beck, the mouse must go back as the over flow was. the last thing is that there was to much of helping methods that made same and repeated conditions checks and as that the whole functionality of moving an element happens during event it should be as small as possible and last i founded in the source some functions for bringing element to front and send them to the back, but they were never used in any point of the source.

although this DargCanvas source is entirely based on the Dragging Elements in a Canvas by John Smith, it still would be quite hard to compare the two since i made some changes


Read More...


I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too. 

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.

[WinXP][Vista][VS2005][C#2.0][.NET3.0][Dev][XAML][WPF][Intermediate]


No comments:

Post a Comment