private static void OnContentChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) { FilterableContentList list = (FilterableContentList)obj; if (list.FilteredItems == null) { list.ContentItems.CollectionChanged += (s, a) => { if (a.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add) { foreach (FilterableContentListItem item in a.NewItems) { list.FilteredItems.Add(item); } } else if (a.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Reset) { list.FilteredItems.Clear(); } list.OnPropertyChanged("FilteredItems"); }; if (list.ContentItems.Count != 0) { list.FilteredItems = new ObservableCollection <FilterableContentListItem>(list.ContentItems); } else { list.FilteredItems = new ObservableCollection <FilterableContentListItem>(); } } }
private static void OnSelectedItemChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) { FilterableContentList list = (FilterableContentList)obj; if (list != null) { list.OnPropertyChanged("SelectedContentObject"); list.OnPropertyChanged("SelectedContentTitle"); list.OnPropertyChanged("SelectedCotnentShortDescription"); list.OnPropertyChanged("SelectedContentDescription"); list.OnPropertyChanged("SelectedContentImageURL"); list.OnPropertyChanged("SelectedContentimageDimensions"); } }