as said in title, it's about Windows 8 Metro style store app.
-Textbox is dynamically generated by Code - Textbox can be dragged by user to anywhere to the screen - user can save the location of textbox anytime - user can restore the location of its previously saved location on screen. - List item
eg.
TextBox t = new TextBox();
t.Name = "TextBoxControl";
// add event for dragging
t.ManipulationDelta += t_ManipulationDelta;
t.RenderTransform = dragTranslation;
// Add textbox to screen
Basic_Root.Children.Add(t)
User can drag and textbox anywhere in the screen, but i need to save the position of this dragged textbox's new location. And there is a button, once clicked, will restore the textbox to its previously saved location, may I know how this can be done?
I thought of saving the Margin value of textbox, and set it later for restoring its position, but it didn't work.
I found something about....
var ttv = MainTextBlock.TransformToVisual(Window.Current.Content);
Point screenCoords = ttv.TransformPoint(new Point(0, 0)
This allow me to see the x,y location of the dragged textbox, so I save the Point, but how can I restore textbox's location with this saved Point?
Many Thanks!