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

BooleanFilterDescriptor

BooleanFilterDescriptor is a descriptor which filters by a property of type bool.

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.

Adding a BooleanFilterDescriptor

Example 1 demonstrates how to leave only the objects, whose PassesFilter property is true.

Example 1: Adding the RadDataGrid in xaml

<Grid xmlns:grid="using:Telerik.UI.Xaml.Controls.Grid" 
      xmlns:dataCore="using:Telerik.Data.Core"> 
    <grid:RadDataGrid x:Name="grid" Width="300" VerticalAlignment="Center"> 
        <grid:RadDataGrid.FilterDescriptors> 
            <dataCore:BooleanFilterDescriptor PropertyName="PassesFilter" Value="true"/> 
        </grid:RadDataGrid.FilterDescriptors> 
    </grid:RadDataGrid> 
</Grid> 

Example 2: Populating the RadDataGrid

public sealed partial class MainPage : Page 
{ 
    public MainPage() 
    { 
        this.InitializeComponent(); 
 
        List<CustomData> data = new List<CustomData> 
        { 
            new CustomData { Country = "Brazil", City = "Caxias do Sul", }, 
            new CustomData { Country = "Brazil", City = "Fortaleza", }, 
            new CustomData { Country = "Spain", City = "Malaga", PassesFilter = true }, 
            new CustomData { Country = "Bulgaria", City = "Koynare" }, 
            new CustomData { Country = "Spain", City = "Valencia", PassesFilter = true }, 
            new CustomData { Country = "Ghana", City = "Kade" }, 
            new CustomData { Country = "Brazil", City = "Porto Alegre" }, 
            new CustomData { Country = "Bulgaria", City = "Byala Slatina" }, 
            new CustomData { Country = "Brazil", City = "Joinville" }, 
        }; 
        this.grid.ItemsSource = data; 
    } 
} 
 
public class CustomData 
{ 
    public string Country { get; set; } 
 
    public string City { get; set; } 
 
    public bool PassesFilter { get; set; } 
} 

Figure 1: RadDataGrid after filtering

BooleanFilterDescriptor example

See Also

In this article
Not finding the help you need?