title: Binding Image Source with Dependency Property
body: <p>I'm working on a custom control. This custom control has an image in it like this:</p>
  
  <pre><code> &lt;Image Source="{TemplateBinding Poster}" /&gt;
  </code></pre>
  
  <p>In my C# file, the <code>DependencyProperty</code> is the following:</p>
  
  <pre><code>public static readonly DependencyProperty PosterProperty = DependencyProperty.Register(
      nameof(Poster), 
      typeof(ImageSource), 
      typeof(MovieButton), 
      new UIPropertyMetadata(null));
  
  public ImageSource Poster
  {
      get { return (ImageSource)GetValue(PosterProperty); }
      set { SetValue(PosterProperty, value); }
  }
  </code></pre>
  
  <p>Now I can add the following to my user control in XAML: <code>Poster="Images/NoPoster.png"</code> or <code>Poster = new BitmapImage(new Uri(@"pack://application:,,,/Images/NoPoster.png"))</code> from code.</p>
  
  <p>Everything is working fine. What I'm wondering is, why can't I declare <code>Poster</code> as <code>BitmapImage</code> or <code>string</code> instead of <code>ImageSource</code>?</p>