windows phone 8 - Drag and drop Image in appropriate position -
i developing app windows phone 8 , want drag , drop image specified position. if position wrong want set initial position.
i using code achieve functionality.
void img1_manipulationcompleted(object sender, system.windows.input.manipulationcompletedeventargs e) { frameworkelement elem = sender frameworkelement; double top = elem.margin.top; double left = elem.margin.left; if (top>249+110/ 2 && left > 212+212/ 2) { system.diagnostics.debug.writeline("top{0},left:{1}", top, left); } else { elem.margin = new thickness(30, 212, 0, 0); } } void img1_manipulationdelta(object sender, manipulationdeltaeventargs args) { frameworkelement elem = sender frameworkelement; generaltransform gt = contentpanel.transformtovisual(elem); point currentpos = gt.transform(new point(0, 0)); elem.margin = new thickness(args.deltamanipulation.translation.x - currentpos.x, args.deltamanipulation.translation.y - currentpos.y, 0, 0); } is there built-in method can tell intersection of appropriate rectangle?
Comments
Post a Comment