Telerik RadGridView problem
- by Polaris
I am using Telerik RadGridView in my project. I want to show image in column.
GridViewImageColumn col1 = new GridViewImageColumn();
col1.Width = 100;
col1.DataMemberBinding = new Binding("id");
col1.Header = "PhotoByConverter";
col1.DataMemberBinding.Converter = new ThumbnailConverter();
grid.Columns.Add(col1);
GridViewImageColumn col2 = new GridViewImageColumn();
col2.Width = 100;
col2.DataMemberBinding = new Binding("firstName");
col2.Header = "Person name";
col2.DataMemberBinding.Converter = new ThumbnailConverter();
grid.Columns.Add(col2);
Grid.ItemsSource=DataTable;
First column not wokrs but second works fine. I use Converter for image shown below
public class ThumbnailConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
IEnumerable<thumbNail> result = from n in thumbnails
where n.personID == value.ToString()
select n;
if (result != null && result.First().thumbnail != null)
{
return result.First().thumbnail.file;
}
else
{
return null;
}
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new Exception("The method or operation is not implemented.");
}
}
I found by id thumbnail of person and set it like data for GridViewImageColumn. I checked with Debuger conveter works properly. I can't undesrtand why it doesn't work.
Any ideas?