FilterEventArgs.Accepted 속성

정의

항목이 필터를 통과하는지 여부를 나타내는 값을 가져오거나 설정합니다.

public:
 property bool Accepted { bool get(); void set(bool value); };
public bool Accepted { get; set; }
member this.Accepted : bool with get, set
Public Property Accepted As Boolean

속성 값

항목이 필터를 통과하면 true이고, 그렇지 않으면 false입니다. 기본값은 true입니다.

예제

다음 예제에 대 한 이벤트 처리기를 설정 하는 방법을 보여 줍니다는 CollectionViewSource.Filter 이벤트입니다. 이 예에서 listingDataView 의 인스턴스가 CollectionViewSource합니다.

listingDataView.Filter += new FilterEventHandler(ShowOnlyBargainsFilter);
AddHandler listingDataView.Filter, AddressOf ShowOnlyBargainsFilter

다음 예제에서는 예제 구현의 ShowOnlyBargainsFilter 필터 이벤트 처리기입니다. 이 이벤트 처리기에서 사용 합니다 FilterEventArgs.Accepted 속성을 필터링 AuctionItem 있는 개체는 CurrentPrice $25.00 이상.

private void ShowOnlyBargainsFilter(object sender, FilterEventArgs e)
{
    AuctionItem product = e.Item as AuctionItem;
    if (product != null)
    {
        // Filter out products with price 25 or above
        if (product.CurrentPrice < 25)
        {
            e.Accepted = true;
        }
        else
        {
            e.Accepted = false;
        }
    }
}
Private Sub ShowOnlyBargainsFilter(ByVal sender As Object, ByVal e As FilterEventArgs)
    Dim product As AuctionItem = CType(e.Item, AuctionItem)
    If Not (product Is Nothing) Then
        'Filter out products with price 25 or above
        If product.CurrentPrice < 25 Then
            e.Accepted = True
        Else
            e.Accepted = False
        End If
    End If
End Sub

전체 예제를 참조 하세요 데이터 바인딩 데모합니다.

적용 대상

추가 정보