private static void OnItemsSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            CollectionFilterBehavior behavior = (CollectionFilterBehavior)d;

            FilterPredicate predicate = behavior.Predicate;

            if (predicate != null)
            {
                predicate.ItemsSource = (IEnumerable)e.NewValue;
            }

            behavior.FilterItems();
        }
        private static void OnPredicateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            CollectionFilterBehavior behavior = (CollectionFilterBehavior)d;

            FilterPredicate oldPredicate = (FilterPredicate)e.OldValue;

            behavior.UnregisterPredicate(oldPredicate);

            FilterPredicate newPredicate = (FilterPredicate)e.NewValue;

            behavior.RegisterPredicate(newPredicate);

            behavior.FilterItems();
        }