Skip to main content
Home Forums Silverlight Design Designing with Silverlight Mouse drag and drop logic
8 replies. Latest Post by kwatts on October 14, 2008.
(0)
TPS2008
Member
14 points
15 Posts
10-10-2008 9:06 AM |
Hi
http://www.tiffany.com/charms/default.aspx?backlink=category
we are trying to design a similar application in silverlight; we can easily achive simple drag and drop function with mouse capture event; However how to implement the fucntionality where in the pendent auto places itself correctly at the preset place.
For example if you will drag and drop a pendent/charm near the chain it goes and auto latches itself to a particular point
Can someone help with the logic
Thanks
Prashant
kwatts
Contributor
2129 points
436 Posts
10-10-2008 2:41 PM |
This should be fairly simple. You'll need to keep track of a set of points which represent possible drop positions for when the user drops the image. Then on the mouse up event that signals a drop action, just translate the image's position to the nearest of the possible drop points. I hope that this helps!
-Ken
10-10-2008 10:41 PM |
Hello Ken
Thanks for the response
Could you please elaborate on how to implement translate the image's position to the nearest of the possible drop points. would there any sample code available anywhere
HarshBar...
Star
9908 points
1,719 Posts
10-11-2008 7:44 AM |
hI,
Check my Reply in this Post.
http://silverlight.net/forums/t/35417.aspx
10-11-2008 10:58 AM |
Prashant,
Here's a link to my Digital Logic Silmulator:
http://kenwatts.blogspot.com/2008/08/digital-logic-simulator-in-silverlight.html
I have a link to the source code at CodePlex from that blog entry. Note that I just upgraded this to RC0, so if you're still running 2B2, you can view it from this link:
http://msbluelight-0.agappdom.net/e1/d/61779/12958351/63359344800/0.vsxHPvfMaG-eYQr97Q-_wxZx4YA/zziframehtml2zz.html#%2f%2fappId%2fDigitalLogicSimulator.xap%2f%2f%2f%2f%2f%2f%2ftrue%2f2.0%2f0
I'm using drag and drop functionality for custom shape objects, and the same technique can be applied to images. Let me know if this helps or if you need further elaboration.
da_dotne...
4 points
2 Posts
10-12-2008 3:15 PM |
Though I havent worked much with silverlight, but had been working in GDI over a long span & already been doing lot of such drag/drop stuff....hence, a suggestive raw logic could be..Initially storing the co-ordinates(points) of the chain in an array. On the MouseUp event, reading the coordinates where its gonna be placed..Now finding the nearest coordinate from the array(that should be a simplest logic) & simply setting the pendants coordinate to that of the nearest found point from that array.
10-14-2008 7:43 AM |
Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;}
Hello Guys
I have implemented the logic by using simple minimum distance calculation formula from 8th grade
it calculates distances and then sticks to nearest co-ordinates
you may view it on http://spinelreview.com/silverlight.aspx
But i am now facing a different kind of problem
it works on some computers and does not work on others ; it shows download silverlight logo ; although silverlight is installed
The strange thing is other silverlight applications/web sites show up fine ; only our application is giving this problem
We have already set all correct MIME types and made application High trust (in case required)
All systems are using XP sp2 with IE or FireFox
Any suggestions
Thank You
prashant
My Silverlight application not working on some computers
10-14-2008 7:53 AM |
Hi,
When it is asking to install you can check which version is installed and which version it is asking to install.
Check in all same version message is coming or what.
it may be due to different versions installed in each machine..
10-14-2008 10:49 AM |
TPS2008:it works on some computers and does not work on others ; it shows download silverlight logo ; although silverlight is installed The strange thing is other silverlight applications/web sites show up fine ; only our application is giving this problem
For me it seems to work fine on my PC that has 2B2 installed and it's not working on my RC0 machine. I would say that this is normal since RC0 does not support 2B2 and vice-versa. This will get cleared up once Silverlight is finally released which should be soon, so you may want to consider upgrading your app to RC0 in preparation for this.