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

Creating custom column filter for boolean value column

2 Answers 212 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Veteran
Martin asked on 26 Jun 2020, 08:13 AM

I have a column in my GridView that consist of boolean values. These values are used to show an icon in the column. Now I want to be able to filter the column so that I can select rows that contain an icon, or rows that does not. 

Currently my filter does not contain any values to filter from. First I want to be able to filter the column. Second I want to customize the names for the checkboxes. So instead of just saying "True" and "False", I would like them to say "My custom string representing the true value" and "My custom string representing the false value".

Is this possible, and how would one go about creating this?

2 Answers, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 01 Jul 2020, 06:56 AM

Hi Martin,

What I could suggest is to create an additional property that returns a string representation of your bool property. The following code snippet demonstrate this.

private bool reminderPassed;
public bool ReminderPassed
{
    get { return reminderPassed; }
    set { reminderPassed = value; this.OnPropertyChanged("ReminderPassed"); }
}

public string ReminderPassed_String
{
    get
    {
// or you can create custom logic here that returns different string 
        return ReminderPassed.ToString();
    }
}

<telerik:GridViewDataColumn
    DataMemberBinding="{Binding ReminderPassed_String}"
    x:Name="ReminderIcon"
    CellStyle="{StaticResource IncidentListTextEffects}"
    Header=""
    IsReadOnly="True"
    IsVisible="{Binding IsTemplateList, Converter={StaticResource InvertBoolConverter}}"
    SortMemberPath="RemindAtLocal" />

I hope this approach will work for you.

Regards,
Dinko
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Martin
Top achievements
Rank 1
Veteran
answered on 01 Jul 2020, 08:18 AM
Hi Dinko, this solution worked for me! Thanks for your help :)
Tags
GridView
Asked by
Martin
Top achievements
Rank 1
Veteran
Answers by
Dinko | Tech Support Engineer
Telerik team
Martin
Top achievements
Rank 1
Veteran
Share this question
or