title: DIsplay Canvas image in WPF Datagrid Column using converter
body: <p>I am total beginner trying to learn WPF/C#, Basically I want following:</p>
  
  <ul>
  <li>Show canvases in multiple places (usualy datagrid columns based on value)</li>
  <li>To use Convertor that will fetch right canvas (based on value and parameter) and return it as imagesource*</li>
  <li>I don't want to convert canvas to imagefile and return filepath</li>
  </ul>
  
  <p>Understand that this is how i imagined to make it, if you have a better solution that doesn't include having image files in folder and using paths it will help me</p>
  
  <p>I have the following XAML: (File: MyApp.Views.MainView.xaml)</p>
  
  <pre><code>    &lt;Window.Resources&gt;
          &lt;conv:ValueToImageConvertor x:Key="_ValueToImageConvertor" /&gt;
      &lt;/Window.Resources&gt;
  
      &lt;DataGridTemplateColumn Header="Icon"&gt;
          &lt;DataGridTemplateColumn.CellTemplate &gt;
              &lt;DataTemplate&gt;
                  &lt;Image Name="img" Source="{Binding SomeValue,Converter={StaticResource _ValueToImageConvertor} ConverterParameter=SomeParameter}" /&gt;
              &lt;/DataTemplate&gt;
          &lt;/DataGridTemplateColumn.CellTemplate&gt;
      &lt;/DataGridTemplateColumn&gt;
  
  </code></pre>
  
  <p>Here is the Resource Dictionary where i store my canvases: (File: MyApp.Resources.ImagesDictionary.xaml)</p>
  
  <pre><code>&lt;ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                      xmlns:local="clr-namespace:MyApp.Resources"&gt;
  
  
      &lt;Viewbox x:Key="i_img1" Width="24" Height="24"&gt;
          &lt;Canvas Width="24" Height="24"&gt;
              &lt;Path Data="XXXXXXX" Fill="Black" /&gt;
          &lt;/Canvas&gt;
      &lt;/Viewbox&gt;
  
      &lt;Viewbox x:Key="i_img2" Width="24" Height="24"&gt;
          &lt;Canvas Width="24" Height="24"&gt;
              &lt;Path Data="YYYYY" Fill="Black" /&gt;
          &lt;/Canvas&gt;
      &lt;/Viewbox&gt;
  
  &lt;/ResourceDictionary&gt;
  </code></pre>
  
  <p>And i want to make a converter:(File: MyApp.Converters.ValueToImageConverter.cs)</p>
  
  <pre><code> public class ValueToImageConverter : IValueConverter
      {
          public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
          {
               //Based on value and parameter get specific canvas and display it
               //get canvas and convert it as image source without creating file
  
          }
      }
  </code></pre>
  
  <p>As i mentioned above, maybe this is a totally bad approach. I am newbie who is trying to learn. Please help me. Thank you.</p>