title: Binding an Image in WPF MVVM
body: <p>I am having some trouble binding in Image to my viewmodel. I finally got rid of the XamlParseException, but the image does not come up. I even hard coded the image in the ViewModel. Can someone see what I am doing wrong?                 </p>
  
  <p>View:</p>
  
  <pre><code>&lt;Image HorizontalAlignment="Left" Margin="0,0,0,0" Name="image1" Stretch="Fill" VerticalAlignment="Bottom" Grid.Row="8" Width="200"  Grid.ColumnSpan="2" &gt;
  &lt;Image.Source&gt;
      &lt;BitmapImage DecodePixelWidth="200" UriSource="{Binding Path=DisplayedImage, Mode=TwoWay}" /&gt;
  &lt;/Image.Source&gt;
  </code></pre>
  
  <p></p>
  
  <p>ViewModel:</p>
  
  <pre><code> string _DisplayedImagePath = @"C:\Users\Public\Pictures\Sample Pictures\Chrysanthemum.jpg";//string.Empty;
      int _DisplayedImageIndex;
      BitmapImage _DisplayedImage = null;
      public BitmapImage DisplayedImage
      {
          get
          {
              _DisplayedImage = new BitmapImage();
              if (!string.IsNullOrEmpty(_DisplayedImagePath))
              {
                  _Rail1DisplayedImage.BeginInit();
                  _Rail1DisplayedImage.CacheOption = BitmapCacheOption.OnLoad;
                  _Rail1DisplayedImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
                  _Rail1DisplayedImage.UriSource = new Uri(_DisplayedImagePath);
                  _Rail1DisplayedImage.DecodePixelWidth = 200;
                  _Rail1DisplayedImage.EndInit();
              }
              return _Rail1DisplayedImage;
          }
          set
          {
              _Rail1DisplayedImage = value;
              OnPropertyChanged("DisplayedImage");
          }
      }
  </code></pre>