Skip to content

SyncfusionExamples/How-to-apply-immediate-filters-in-the-filter-row-after-entering-at-least-5-characters

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

How to apply immediate filters in the filter row after entering at least 5 characters in WPF DataGrid?

In WPF DataGrid (SfDataGrid), by default, filters are applied immediately upon entering text in the FilterRow when the GridColumn.ImmediateUpdateColumnFilter property is set to true for the corresponding column.

However, we can customize the immediate filter behavior of the FilterRow by creating a custom renderer that inherits from FilterRowCellRenderers. By overriding the ProcessSingleFilter method, filters can be applied when the filter value contains five or more characters, and removed when the filter length reaches zero.

Overriding the renderer

   this.datagrid.FilterRowCellRenderers.Remove("TextBox");
   this.datagrid.FilterRowCellRenderers.Add("TextBox", new GridFilterRowTextBoxRendererExt());

GridFilterRowTextBoxRendererExt class

public class GridFilterRowTextBoxRendererExt : GridFilterRowTextBoxRenderer
{
    public GridFilterRowTextBoxRendererExt() : base()
    {
    }

    public override void ProcessSingleFilter(object filterValue)
    {
        if (filterValue.ToString().Length >= 5)
            base.ProcessSingleFilter(filterValue);
    }  
 }

sum68Emx48.gif

Take a moment to persue the WPF DataGrid - FilterRow documentation, where you can find about the FilterRow customizations with code examples.

About

How to apply immediate filters in the filter row after entering at least 5 characters

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages