Ejemplo n.º 1
0
        /// <summary>
        /// Handles changes to the Parent property.
        /// </summary>
        private static void OnParentCollectionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            FilterControl target    = (FilterControl)d;
            IEnumerable   oldParent = (IEnumerable)e.OldValue;
            IEnumerable   newParent = (IEnumerable)e.NewValue;

            target.OnParentCollectionChanged(oldParent, newParent);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Handles changes to the FilterInitializersManager property.
        /// </summary>
        private static void OnFilterInitializersManagerChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            FilterControl target = (FilterControl)d;

            if (!isInDesignMode && target.Model != null)
            {
                throw new InvalidOperationException("Change Key after FilterControl was attached to FilterPresenter not allowed.");
            }
            FilterInitializersManager oldFilterInitializersManager = (FilterInitializersManager)e.OldValue;
            FilterInitializersManager newFilterInitializersManager = (FilterInitializersManager)e.NewValue;

            target.OnFilterInitializersManagerChanged(oldFilterInitializersManager, newFilterInitializersManager);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Handles changes to the Key property.
        /// </summary>
        private static void OnKeyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            FilterControl target = (FilterControl)d;

            if (!isInDesignMode && target.Model != null)
            {
                throw new InvalidOperationException("Change Key after FilterControl was attached to FilterPresenter not allowed.");
            }
            string oldKey = (string)e.OldValue;
            string newKey = (string)e.NewValue;

            target.OnKeyChanged(oldKey, newKey);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Handles changes to the Model property.
        /// </summary>
        private static void OnModelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            FilterControl target = (FilterControl)d;

            FilterControlVm oldModel = (FilterControlVm)e.OldValue;

            if (oldModel != null)
            {
                oldModel.Dispose();
                oldModel.StateChanged -= target.OnStateChanged;
                target.ItemsSource     = null;
            }
            FilterControlVm newModel = target.Model;

            if (newModel != null)
            {
                newModel.StateChanged += target.OnStateChanged;
                target.ItemsSource     = newModel;
                target.SetVisualState(newModel.State);
            }
            target.OnModelChanged(newModel);
        }