Windows Phone 7 Silverlight: How to place an image at a co-ordinate

by sunil ravulapalli /30. March 2010 03:30 /windows-phone /Comments (0)

To do this you will need a Canvas in the "ContentGrid" in the MainPage.xaml.


In MainPage.xaml.cs, set co-ordinates using img.SetValue(Canvas.TopProperty, 100.0) and img.SetValue(Canvas.LeftProperty, 100.0);

public MainPage()

       SupportedOrientations = SupportedPageOrientation.Portrait |

       Image img = new Image();

       //Size the Image
       img.Height = 80;
       img.Width = 80;

       //Point at the physical file
       Uri uri = new Uri("1.JPG", UriKind.Relative);
       ImageSource imgsource = new

       //Set image property
       img.SetValue(Image.SourceProperty, imgsource);

       //Set co-ordinates
       img.SetValue(Canvas.TopProperty, 100.0);
       img.SetValue(Canvas.LeftProperty, 100.0);

blog comments powered by Disqus