New to Telerik UI for WinUI? Download free 30-day trial

FilterButtonTap Command

Handles the tap gesture over a filter button. The default implementation will open the Filtering Flyout.

Execution Parameter

The execution parameter is of type FilterButtonTapContext which exposes the following properties:

  • AssociatedDescriptor: Gets the FilterDescriptorBase instance associated with the context. Typically this is the PropertyFilterDescriptor already applied to the column instance.
  • FirstFilterControl: Gets or sets the IFilterControl control that represents the UI used to generate the first FilterDescriptorBase.
  • SecondFilterControl: Gets or sets the IFilterControl control that represents the UI used to generate the second FilterDescriptorBase.
  • Column: Gets the DataGridColumn instance that owns the filter button being tapped.

Custom FilterButtonTap Command

Examples 1 and 2 show how to create a class that inherits from DataGridCommand and add it to the Commands collection.

Example 1: Creating a custom FilterButtonTap Command

public class CustomFilterButtonTapCommand : DataGridCommand 
{ 
    public CustomFilterButtonTapCommand() 
    { 
        this.Id = CommandId.FilterButtonTap; 
    } 
 
    public override bool CanExecute(object parameter) 
    { 
        var context = parameter as FilterButtonTapContext; 
        // put your custom logic here 
        return true; 
    } 
 
    public override void Execute(object parameter) 
    { 
        var context = parameter as FilterButtonTapContext; 
        // put your custom logic here    
 
        this.Owner.CommandService.ExecuteDefaultCommand(CommandId.FilterButtonTap, context);             
    } 
} 

Example 2: Adding the custom Command to the Commands collection

<Grid xmlns:grid="using:Telerik.UI.Xaml.Controls.Grid"> 
    <grid:RadDataGrid Width="600" Height="460" x:Name="grid" Hold> 
        <grid:RadDataGrid.Commands> 
              <local:CustomFilterButtonTapCommand/> 
        </grid:RadDataGrid.Commands> 
    </grid:RadDataGrid> 
</Grid> 

See Also

In this article
Not finding the help you need?