ListCollectionView にバインドしない理由をフィルタリングする必要がある場合は、ここにアイデアがあります
in the View
ComboBox ItemsSource="{Binding PersonsView}" //instead of Persons
あなたのViewModelで:
public ListCollectionView PersonsView
{
get { return _personsView; }
private set
{
_personsView= value;
_personsView.CommitNew();
RaisePropertyChanged(()=>PersonsView);
}
}
リストに入力したら
PersonsView= new ListCollectionView(_persons);
ビューのどこかに、フィルターを更新するコンボボックスの変更に応答する場所が明らかにあり、そこにフィルターを適用できます
_viewModel.PersonsView.Filter = ApplyFilter;
ApplyFilter は、表示される内容を決定するアクションです
//this will evaluate all items in the collection
private bool ApplyFilter(object item)
{
var person = item as Person;
if(person == null)
{
if(person is in that 30 top percent records)
return false; //don't filter them out
}
return true;
}
//or you can do some other logic to test that Condition that decides which Person is displayed, this is obviously a rough sample
}