title: Loading images source dynamically with IValueConverter
body: <p>I've problems with IValueconverter and dynamically load a row grid image:</p>
  
  <pre><code>public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  {
  
      string Type = (string)value;
      Uri uri;
      try
      {
          uri = new Uri("/XConsole;component/Images/" + Type + ".png", UriKind.Relative);
          return new System.Windows.Media.Imaging.BitmapImage(uri) { CacheOption = BitmapCacheOption.None };
      }
      catch (Exception e)
      {
          //donothing
      }
      uri = new Uri("/XConsole;component/Images/Type_SYSTEM.png", UriKind.Relative);
      return new System.Windows.Media.Imaging.BitmapImage(uri) { CacheOption = BitmapCacheOption.None };
  
  }
  </code></pre>
  
  <p>I want to pass to converter a "Type" of my object and load different images:</p>
  
  <pre class="lang-xml prettyprint-override"><code> &lt;Image Grid.Column="0"  Width="25" Height="25" Margin="2,0" Source="{Binding Path=Type, Converter={StaticResource imageConverter}}" &gt;
  </code></pre>
  
  <p>But there is something wrong because no picture are loaded! </p>
  
  <p>if i load statically, it' s ok:</p>
  
  <pre class="lang-xml prettyprint-override"><code> &lt;Image Grid.Column="0"  Width="25" Height="25" Margin="2,0" Source="/XconsoleTest;component/Images/Type_DB.png" &gt;
  </code></pre>
  
  <p>i loaded my converter in UserControl.Resources:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;UserControl.Resources&gt;
      &lt;converters:ImageConverter x:Key="imageConverter"/&gt;
  &lt;/UserControl.Resources&gt;
  </code></pre>
  
  <p>Help me!! </p>