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

NumericalFilterDescriptor

The NumericalFilterDescriptor filters the data by a property of a numerical type.

Properties

  • PropertyName—Gets or sets the name of the property that is used to retrieve the value to filter by.
  • Value—Gets or sets the value used in the comparisons. This is the right operand of the comparison.
  • Operator—Gets or sets the NumericalOperator value that defines the Boolean logic behind the left and right operand comparison.

Adding a NumericalFilterDescriptor

The following example demonstrates how to leave only the objects, whose CityPopulation property is less than 20 000.

Add the DataGrid in XAML

<Grid xmlns:grid="using:Telerik.UI.Xaml.Controls.Grid" 
     xmlns:dataCore="using:Telerik.Data.Core"> 
    <grid:RadDataGrid x:Name="grid" VerticalAlignment="Center"> 
        <grid:RadDataGrid.FilterDescriptors> 
            <dataCore:NumericalFilterDescriptor PropertyName="CityPopulation" 
                                               Operator="IsLessThan" 
                                               Value="20000"/> 
        </grid:RadDataGrid.FilterDescriptors> 
    </grid:RadDataGrid> 
</Grid> 

Populate the DataGrid with Data

public sealed partial class MainPage : Page 
{ 
    public MainPage() 
    { 
        this.InitializeComponent(); 
 
        List<CustomData> data = new List<CustomData> 
        { 
            new CustomData { Country = "Brazil", City = "Caxias do Sul", CityPopulation = 450000 }, 
            new CustomData { Country = "Brazil", City = "Fortaleza", CityPopulation = 2500000 }, 
            new CustomData { Country = "Spain", City = "Malaga", CityPopulation = 569000 }, 
            new CustomData { Country = "Bulgaria", City = "Koynare", CityPopulation = 5000 }, 
            new CustomData { Country = "Spain", City = "Valencia", CityPopulation = 810000 }, 
            new CustomData { Country = "Ghana", City = "Kade", CityPopulation = 16000 }, 
            new CustomData { Country = "Brazil", City = "Porto Alegre", CityPopulation = 1510000 }, 
            new CustomData { Country = "Bulgaria", City = "Byala Slatina", CityPopulation = 11000 }, 
            new CustomData { Country = "Brazil", City = "Joinville", CityPopulation = 515000 }, 
        }; 
        this.grid.ItemsSource = data; 
    } 
} 
 
public class CustomData 
{ 
    public string Country { get; set; } 
 
    public string City { get; set; } 
 
    public double CityPopulation { get; set; } 
} 
DataGrid after Filtering

WinUI NumericalFilterDescriptor example

See Also

In this article
Not finding the help you need?