c# - Drag textbox in a grid -
i wanted ask how move textbox child of grid. code changes left of textbox doesn't move it. there way set parent of textbox canvas. thank response in advance.
private void handle_drag(object sender, manipulationdeltaeventargs e) { textbox text = sender textbox; text.text = "i'm moved"; double currentx = canvas.getleft(text); double currenty = canvas.gettop(text); messagebox.show(currentx.tostring()); messagebox.show(currenty.tostring()); canvas.setleft(text, currentx + e.deltamanipulation.translation.x); canvas.settop(text, currenty + e.deltamanipulation.translation.y); }
try find parent of textbox , remove grid.
private void handle_drag(object sender,system.windows.input.manipulationdeltaeventargs e) { textbox text = sender textbox; var parent = text.parent grid; if (parent != null) { parent.children.remove(text); mycanvas.children.add(text); } text.text = "i'm moved"; double currentx = canvas.getleft(text); double currenty = canvas.gettop(text); messagebox.show(currentx.tostring()); messagebox.show(currenty.tostring()); canvas.setleft(text, currentx + e.deltamanipulation.translation.x); canvas.settop(text, currenty + e.deltamanipulation.translation.y); } or can use interaction behaviors api drag. http://developer.nokia.com/community/wiki/drag_%26_drop_in_windows_phone
Comments
Post a Comment