Dynamiczne ładowanie źródła obrazów za pomocą IValueConverter

Mam problemy z IValueconverter i dynamicznie ładuję obraz siatki wiersza:

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 };

}

Chcę przekazać konwerter „typu” mojego obiektu i załadować różne obrazy:

 <Image Grid.Column="0"  Width="25" Height="25" Margin="2,0" Source="{Binding Path=Type, Converter={StaticResource imageConverter}}" >

Ale coś jest nie tak, ponieważ nie ma załadowanego obrazu!

jeśli ładuję statycznie, jest OK:

 <Image Grid.Column="0"  Width="25" Height="25" Margin="2,0" Source="/XconsoleTest;component/Images/Type_DB.png" >

załadowałem mój konwerter w UserControl.Resources:

<UserControl.Resources>
    <converters:ImageConverter x:Key="imageConverter"/>
</UserControl.Resources>

Pomóż mi!!

questionAnswers(1)

yourAnswerToTheQuestion