In my project, i have a folder called Images, where all the images iam using in my application are saved in subfolders.All the images are set to "Resource" in the buildprocess.
myproject
|__Images
|__AppImages
|__StarOn.png
|__StarOff.png
Now, if i do set my image manually like this:
<Image Source="Images\AppImages\StarOn.png" width="32" height="32"/>
the image is correctly shown in the imagebox.
i would like to set the image using a converter and a binding like this:
<Image>
<Image.Source>
<Binding Path="Number" converter="{StaticResource GetImagePathConverter}"/>
</Image.Source>
</Image>
where the number is an integer
and my converter is:
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
int questionNr=int.parse(value.ToString());
if (questionNr>100)
{
return "Images\\AppImages\\StarOn.png";
}
return "Images\\AppImages\\starOff.png";
}
but this is not changing the image ?..
what iam doing wrong ? how can i set the image source correctly from the converter ?
thanks in advance