c# - How do I get the X,Y position of a UserControl within a Canvas? -


i have simple usercontrol implemented below - place in canvas. move using multi-touch , want able read new x,y postion using procedural c# code. ideally have x , y 2 properties or point (x,y).

<usercontrol x:class="touchcontrollibrary.mycontrol"              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"               xmlns:d="http://schemas.microsoft.com/expression/blend/2008"               mc:ignorable="d"               d:designheight="64" d:designwidth="104">     <border name="controlborder" borderthickness="1" borderbrush="black">         <dockpanel margin="1" height="60 " width="100">             <stackpanel  dockpanel.dock="left" background="gray"  width="20" >                 <button background="#ffdede53" padding="0">in</button>             </stackpanel>             <stackpanel  dockpanel.dock="right" background="gray"  width="20" >                 <button background="#ffe8b48f" padding="0">out</button>             </stackpanel>         </dockpanel>       </border> </usercontrol> 

i expected able create attached property each of 'x' , 'y' , fill them canvas.left , canvas.top, using binding or form of attached property or maybe else entirely.

however, despite spending quite time searching solution, found far seems 'not quite needed'.

what suggest solve problem?

let me see if have right, create new instance of user control , add canvas? move using multi-touch (how do this? via behaviour or manually?), , @ 1 time want read new x/y position of instance of user control relative canvas?

why cant read same thing being changed when move via touch? have had @ rendertransform property, changed when manipulate using behavior or manual adjustments.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -