title: Displaying bitmap image in wpf datagrid defined at runtime
body: <p>Looking for some guidance as to how to display an image correctly in a wpf datagrid whose columns are defined at runtime, I can't define the columns in XAML.</p>
  
  <p>My grids underlying collection contains an integer field that relates to a certain image.</p>
  
  <p>I create a DataGridTextColumn column on my datagrid at runtime and bind it and set a converter.</p>
  
  <pre><code>Binding binding = new Binding("MyIntegerField");
  binding.Converter = new Converters.IconIndexToImageConverter();
  </code></pre>
  
  <p>and my converter looks like this ;</p>
  
  <pre><code>public class IconIndexToImageConverter: IValueConverter
  {
      public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
      {
          System.Drawing.Bitmap bitmap = null;
          if (value != null)
          {
              int imageIndex = (int)value;
              switch (imageIndex)
              {
                  case 1:
                      return Properties.Resources.clip;
  </code></pre>
  
  <p>but in my grid I don't see the image but see the type name, System.Drawing.Bitmap. All other bound fields are being displayed correctly.</p>
  
  <p>I can see that the converter is being hit for this column, am I missing something on the binding?</p>
  
  <p>Thanks....</p>