private bool FilterItems(object item) { bool result = false; var typedItem = item as Jurisdiction; if (typedItem != null && SelectedJurisdictions.All(x => x.JurisdictionId != typedItem.JurisdictionId)) { result = true; } return(result); }
protected override void InitializePropertiesForViewing() { using (var repository = _repositoryFactory.GetRepositoryInstance()) { var items = repository.Jurisdictions.Where(x => x.JurisdictionType == (int)JurisdictionTypes.All || x.JurisdictionType == (int)_jurisdictionType); OnUIThread(() => { AllAvailableJurisdictions.SetItems(items); SelectedJurisdictions.SetItems(InnerItem.JurisdictionRelations.Select(x => x.Jurisdiction)); var view = CollectionViewSource.GetDefaultView(AllAvailableJurisdictions); view.Filter = FilterItems; }); } }