canvas.getleft for image returns 0 in WP7


I m trying to get the image position in my canvas. But Canvas.GetLeft and Canvas.GetTop always return 0 even though I drag the image across the canvas. Here is the piece of code below.

private void MouseDragElementBehavior_DragFinished(object sender, MouseEventArgs e) { MessageBox.Show("Canvas Left Position" + Canvas.GetLeft(image1).ToString()); MessageBox.Show("Canvas Top Position" + Canvas.GetTop(image1)).ToString(); MessageBox.Show("Canvas Index" + Canvas.GetZIndex(image1)); }

Please let me know how to solve this issue.


The MouseDragElementBehavior uses a MatrixTransformation, not the canvas' top and left properties.

To retrieve the position, you can try using X and Y properties of the MouseDragElementBehavior:

private void MouseDragElementBehavior_DragFinished(object sender, MouseEventArgs e) { var behavior = (MouseDragElementBehavior)sender; System.Diagnostics.Debug.WriteLine("Position: " + behavior.X + " / " + behavior.Y); }


  • doubleValue does not convert the object to a double value correctly at all times
  • wxWidgets: Detecting click event on custom controls
  • Where to put clearQueue in jQuery code
  • Scrolling News Ticker Jquery - Issues
  • How to control Trigger state (Pause, Play) using code (not just buttons)
  • Is there an easy way to associate an event with a ListViewItem?
  • Prevent parent page from scrolling when mouse is over embedded iframe
  • Exception HRESULT: 0x800455BC in speech recognition in Windows phone 8
  • Adding directive inside the directive programatically
  • How to access recipient on sent messages page with mailboxer
  • How do you remove the JComboBox 'click and see dropdown' functionality?
  • Click on button in another program - FindWindow, C#
  • Android device acting as an accessory
  • c# open webrowser in many tab
  • How to Cache Real-time Data?
  • preg_replace Double Spaces to tab (\\t) at the beginning of a line
  • Listbox within Listbox and scrolling trouble in Windows Phone 7 Silverlight
  • Disable Enter in editText android
  • output of program is not same as passed argument
  • javascript inside java/jsp code
  • How to check if every primary key value is being referenced as foreign key in another table
  • Sending data from AppleScript to FileMaker records
  • Javascript + PHP Encryption with pidCrypt
  • Akka Routing: Reply's send to router ends up as dead letters
  • AT Commands to Send SMS not working in Windows 8.1
  • KeystoneJS: Relationships in Admin UI not updating
  • AngularJs get employee from factory
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • Load html files in TinyMce
  • python regex in pyparsing
  • How do I configure my settings file to work with unit tests?
  • Getting Messege Twice Using IMvxMessenger
  • Exception on Android 4.0 `android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode)`
  • Is it possible to post an object from jquery to bottle.py?
  • unknown Exception android
  • EntityFramework adding new object to nested object collection
  • Checking variable from a different class in C#
  • How can i traverse a binary tree from right to left in java?
  • failed to connect to specific WiFi in android programmatically
  • How can I use threading to 'tick' a timer to be accessed by other threads?