title: wpf how to change a canvas image Position programmatically
body: <p><a href="https://i.stack.imgur.com/z6o18.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/z6o18.jpg" alt="enter image description here"></a></p>
  
  <p>I am a student on my final year and im doing a project regarding WPF but i'm totally new to WPF and i have been assigned some tasks,but im currently stuck on how to change the Image position on the canvas programitically from left to right.below are the codes</p>
  
  <pre><code>&lt;&lt;Window x:Class="changing_bird_position.MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Title="MainWindow" Height="450" Width="800"&gt;
  &lt;StackPanel&gt;
      &lt;Canvas Name="canvas" Background="LightBlue" Width="500" Height="280" Margin="264,0,28,0"&gt;
          &lt;Image Source="inlandbird.png" Name="Image" Height="43" Canvas.Left="55" Canvas.Top="22"/&gt;
      &lt;/Canvas&gt;
  
      &lt;Button Content="Button" Click="Button_Click" Width="50" Height="50" Margin="246,0"/&gt;
  &lt;/StackPanel&gt;
  </code></pre>
  
  <p></p>
  
  <p>Xaml.cs</p>
  
  <pre><code>public partial class MainWindow : Window
  {
      Image img = new Image();
      public MainWindow()
      {
          InitializeComponent();
  
      }
  
      private void Button_Click(object sender, RoutedEventArgs e)
      {
          Canvas.SetLeft(img, 200.0);
          Canvas.SetTop(img, 200.0);
  </code></pre>