filter ignoring accents

1 Answer 53 Views
Treeview
Danny
Top achievements
Rank 1
Iron
Veteran
Iron
Danny asked on 09 Apr 2022, 01:45 PM
Greetings, how can I tell the RadTreeView to ignore accent when applying Filter.

the content of my RadTreeView there are nodes that have accents in the text, for example Balance Calculation, and if I search without an accent it does not search for me

How do I tell the TreeView Filter to ignore accents?

Use:
Visual Studio 2022
.Net Framework 4.8
Telerik WinForms 22.1.222.0

1 Answer, 1 is accepted

Sort by
1
Accepted
Dinko | Tech Support Engineer
Telerik team
answered on 12 Apr 2022, 01:45 PM

Hello Danny,

Thank you for the provided details.

In this case, you could consider using custom filtering. You can create a custom method that accepts RadTreeNode and uses the string.Compare() method you could ignore the accent and compare the strings. More information can be found in the Custom Filtering help article in our documentation. Here is a sample code that demonstrates what I have in mind.

public RadForm1()
{
    InitializeComponent();
    radTreeView1.TreeViewElement.FilterPredicate = FilterNode;
}

private bool FilterNode(RadTreeNode node)
{
    var filterText = this.radTreeView1.Filter;
    var result = string.Compare(node.Text, filterText.ToString(), CultureInfo.CurrentCulture, CompareOptions.IgnoreNonSpace);
    if (result == 0)
    {
        // the strings are equal
        return true;
    }
    return false;
}

private void radButton1_Click(object sender, EventArgs e)
{
    this.radTreeView1.Filter = "Sorina";
}

I am also attaching the sample project which I used to test your case. 

Regards,
Dinko
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Danny
Top achievements
Rank 1
Iron
Veteran
Iron
commented on 12 Apr 2022, 02:00 PM | edited

thanks for the response.
Tags
Treeview
Asked by
Danny
Top achievements
Rank 1
Iron
Veteran
Iron
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or