コード例 #1
0
        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();
        }
コード例 #2
0
        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();
        }