private void OnItemsSourceChanged() { if (_listBox != null) { if (ItemsSource != null) { FilteredItems = (IObservableCollectionView)typeof(ObservableCollectionView <>) .CreateGenericObject(ItemsSource.GetType().GenericTypeArguments[0], ItemsSource); FilteredItems.Filter = new Func <object, bool>(ApplyFilter); _listBox.ItemsSource = FilteredItems; } else { _listBox.ItemsSource = null; } } }
private void OnItemsSourceChanged() { if (_listBox != null) { if (ItemsSource != null) { FilteredItems = (IObservableCollectionView)typeof(ObservableCollectionView<>) .CreateGenericObject(ItemsSource.GetType().GenericTypeArguments[0], ItemsSource); FilteredItems.Filter = new Func<object, bool>(ApplyFilter); _listBox.ItemsSource = FilteredItems; } else _listBox.ItemsSource = null; } }