Пример #1
0
        /// <summary>
        /// Handles changes to the ParentCollection property.
        /// </summary>
        private static void OnParentCollectionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            CityFilter             target = (CityFilter)d;
            IEnumerable <CityItem> oldParentCollection = (IEnumerable <CityItem>)e.OldValue;

            if (target.filterPresenter != null)
            {
                bool isActive = target.IsActive;
                if (isActive)
                {
                    target.IsActive = false;
                }
                target.filterPresenter.ReceiveFilterChanged(target);
                if (isActive)
                {
                    target.IsActive = true;
                }
            }
            IEnumerable <CityItem> newParentCollection = target.ParentCollection;

            target.filterPresenter = FilterPresenter.TryGet(newParentCollection);
            if (target.filterPresenter != null)
            {
                target.filterPresenter.ReceiveFilterChanged(target);
            }
            target.OnParentCollectionChanged(oldParentCollection, newParentCollection);
        }
Пример #2
0
        /// <summary>
        /// Handles changes to the Country property.
        /// </summary>
        private static void OnCountryChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            CityFilter target     = (CityFilter)d;
            string     oldCountry = (string)e.OldValue;
            string     newCountry = target.Country;

            if (target.filterPresenter != null)
            {
                target.filterPresenter.ReceiveFilterChanged(target);
            }
            target.OnCountryChanged(oldCountry, newCountry);
        }
Пример #3
0
        /// <summary>
        /// Handles changes to the IsActive property.
        /// </summary>
        private static void OnIsActiveChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            CityFilter target = (CityFilter)d;

            if (target.filterPresenter != null)
            {
                target.filterPresenter.ReceiveFilterChanged(target);
            }
            bool oldIsActive = (bool)e.OldValue;
            bool newIsActive = target.IsActive;

            target.OnIsActiveChanged(oldIsActive, newIsActive);
        }