CollectionView for WinForms
フィルタ処理
CollectionView の操作 > フィルタ処理

CollectionView implements the ICollectionView interface to support filtering, which enables you to filter data using the FilterAsync method of the C1CollectionView class. This method calls the filtering operation in the collection view and refines data according to the user requirements without including other data that can be repetitive or irrelevant. CollectionView fires FilterChanged event when a filter operation is performed. In addition, CollectionView allows you to fetch the filter expression applied to the data using the FilterExpression property.

The following GIF displays how the filtering is implemented using the FilterAsync method.

The following code implements filtering in DataGridView according to the specified filtering criteria using appropriate filter operator and filter values in the FilterAsync method. In this example, data is filtered in DataGridView on the basis of the provided filter condition. This example uses the sample created in the Quick Start section.

Private Async Sub btnFilter_Click(sender As Object, e As EventArgs) Handles btnFilter.Click
    Await cv.FilterAsync("Name", FilterOperation.StartsWith, "He")
End Sub
private async void btnFilter_Click(object sender, EventArgs e)
{
    await cv.FilterAsync("Name", FilterOperation.StartsWith, "He");
}