This is a migrated thread and some comments may be shown as answers.

GridViewImageColumn filter with image

6 Answers 173 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Hakki
Top achievements
Rank 1
Hakki asked on 01 Nov 2012, 02:51 PM
Hey guys,

I have GridViewImageColumn and when I filter it, the filter lists the images by their location (i.e: images/image.png). How do I make it so when filtering a image column, instead of listing the location it lists the images themselves?

Thanks a lot.

6 Answers, 1 is accepted

Sort by
0
Accepted
Rossen Hristov
Telerik team
answered on 01 Nov 2012, 02:57 PM
Hi,

While this cannot be supported out-of-the-box, you can check this sample project and customize it according to your needs.

All the best,
Rossen Hristov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Hakki
Top achievements
Rank 1
answered on 01 Nov 2012, 03:19 PM
Hey,

Very cool and simple. Worked like a charm. Thanks a lot!


I am sometimes in a situation where I can't download demo projects so if anyone gets here from google under same circumstance, this is the class you need (from the project above):

public class ImageFilterColumn : GridViewImageColumn
{
    /// <summary>
    /// Gets the filtering display function.
    /// </summary>
    /// <value>The filtering display function.</value>
    /// <remarks>This function is used by the filtering control distinct values list.
    /// It accepts a raw data value and returns what will become the content of the
    /// distinct value checkbox.</remarks>
    protected override Func<object, object> FilteringDisplayFunc
    {
        get { return ImageFilterColumn.ConvertUriStringToImage; }
    }
 
    public static object ConvertUriStringToImage(object uriString)
    {
        var image = new Image();
        image.Source = new BitmapImage(new Uri(uriString.ToString(), UriKind.Relative));
        return image;
    }
}

And then make a column of that class:
<my:ImageFilterColumn DataMemberBinding="{Binding Image}" ShowFieldFilters="False" />
0
Asaf
Top achievements
Rank 1
answered on 12 Jul 2016, 12:40 PM

It works wonderfull except case the Binding member is boolean data which converted to image by Converter function.

Do You have any good additional to solve it?

0
Stefan Nenchev
Telerik team
answered on 15 Jul 2016, 07:39 AM
Hello Asaf,

I am not sure of the exact setup at your end but I have updated the sample project with a possible approach. Please review it and update the thread whether the information was useful.

Regards,
Stefan Nenchev
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Shayan
Top achievements
Rank 1
answered on 21 Dec 2018, 06:30 AM
Gandu Is m kuch bhi naii h khali h ya
0
Yoan
Telerik team
answered on 25 Dec 2018, 01:32 PM
Hi Shayan,

Please note that the official language of communication in our support channels is English and we may not be able to provide you with an adequate response if you have inquiries in another language.

Regards,
Yoan
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
GridView
Asked by
Hakki
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Hakki
Top achievements
Rank 1
Asaf
Top achievements
Rank 1
Stefan Nenchev
Telerik team
Shayan
Top achievements
Rank 1
Yoan
Telerik team
Share this question
or