我有复选框:
<CheckBox Name="Filtering" Grid.Row="1" Grid.Column="1"
Checked="AddFiltering" Unchecked="RemoveFiltering"
Margin="8" Style="{StaticResource checkBoxStyle}">Show only bargains</CheckBox>
我有 AddFiltering 方法:
private void AddFiltering(object sender, RoutedEventArgs args)
{
listingDataView.Filter += new FilterEventHandler(ShowOnlyBargainsFilter);
}
我有 ShowOnlyBargains 方法:
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;
}
}
}
而且我这里也有问题:-)
ShowOnlyBargainsFilter 返回 void。它真正改变的只是参数值,即:
e.接受=真;
我猜这个变化是发回给某种呼叫者的?它是如何工作的?
谢谢!