binding image with 2 values with convertor
- by prince23
hi,
is it possiable to set 2 data field for an image control whiling binding
**<Image Source="{Binding ItemID, Converter={StaticResource IDToImageConverter}}" Height="50" />**
now here i need to add one more value Price now. need to send even price as an paramter for IDToImageConverter function
how can i do it?
now i need to check first price value there are 3 condition i neeed to check
in my IDToImageConverter function
if( price> 5o)
{
// then get the ItemID based on the value bind image here
if(ItemID >20)
{
// bind image1
}
if(ItemID >50)
{
// bind image2
}
}
if( price> 100)
{
// as above codition we do here
}
now how can i add these above functionality in IDToImageConverter ?
any idea how i can solve it
<Image Source="{Binding ItemID, Converter={StaticResource IDToImageConverter}}" Height="50" />
</DataTemplate>
</data:DataGridTemplateColumn.CellTemplate>
</data:DataGridTemplateColumn>
</data:DataGrid.Columns>
</data:DataGrid>
public class IDToImageConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
Uri uri = new Uri("~/Images/" + value.ToString()+ ".jpg", UriKind.Relative);
return new BitmapImage(uri);
}
thanks in advance. for anyhelp you provide
prince