title: How can I create a tiled image in code that is also data-bound?
body: <p>Current in code-behind, I dynamically create a WPF Image control and bind the source to a custom databinding.  This will eventually be added to a grid to provide a background image:</p>
  
  <pre><code>Image myImage = new Image();
  myImage.Stretch = Stretch.UniformToFill;
  myImage.SetBinding(Image.SourceProperty, myBinding);
  </code></pre>
  
  <p>The problem is that I want to tile this image, so the only way I can find to do this is to create an ImageBrush and set the TileMode property.  But there is no "SetBinding" function, so how can I accomplish what I need?</p>
  
  <pre><code>ImageBrush myBrush = new ImageBrush();
  myBrush.TileMode = TileMode.Tile;
  // Can't do this!
  myBrush.SetBinding(ImageBrush.SourceImageProperty, myBinding);
  </code></pre>
  
  <p>Are there any other ways to tile an image like this in code-behind?</p>