FilterEventArgs.Item Propriedade
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Obtém o objeto que o filtro deve testar.
public:
property System::Object ^ Item { System::Object ^ get(); };
public object Item { get; }
member this.Item : obj
Public ReadOnly Property Item As Object
Valor de Propriedade
O objeto que o filtro deve testar. A predefinição é null.
Exemplos
O exemplo seguinte mostra como definir um gestor de eventos para o CollectionViewSource.Filter evento. Neste exemplo, listingDataView é uma instância de CollectionViewSource.
listingDataView.Filter += new FilterEventHandler(ShowOnlyBargainsFilter);
AddHandler listingDataView.Filter, AddressOf ShowOnlyBargainsFilter
O exemplo seguinte mostra a implementação do exemplo ShowOnlyBargainsFilter de gestor de eventos de filtro. Este gestor de eventos usa a FilterEventArgs.Accepted propriedade para filtrar AuctionItem objetos que tenham a CurrentPrice $25.00 ou mais.
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