コード例 #1
0
        // CategoryList DP

        private static void OnCategoryListChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            PropertyToolBar theThis = obj as PropertyToolBar;

            if (theThis == null)
            {
                return;
            }

            if (e.OldValue != null)
            {
                theThis.UnhookEvents(e.OldValue as CategoryList);
            }

            if (e.NewValue != null)
            {
                theThis.HookEvents(e.NewValue as CategoryList);
            }
        }
コード例 #2
0
        // CurrentViewManager DP

        private static void OnCurrentViewManagerChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            PropertyToolBar theThis = obj as PropertyToolBar;

            if (theThis == null)
            {
                return;
            }

            theThis.OnPropertyChanged("IsCategoryViewSelected");
            theThis.OnPropertyChanged("IsAlphaViewSelected");

            // Store and persist the CurrentViewManager value only if:
            //
            // * this change did not come from PropertyViewManagerStateContainer itself
            // * we have a persistence ID to differentiate this control instance by
            // * this is not the first time the value was set - in other words, only
            //   store values that were triggered by the user making a conscious change
            //
            if (theThis.PersistenceId != null && theThis._persistViewManagerChanges && e.OldValue != null)
            {
                PropertyViewManagerStateContainer.Instance.StorePropertyViewManager(theThis.PersistenceId, e.NewValue as IPropertyViewManager);
            }

            // fire this event after we have stored the propertyviewmanager, so that the StateChanged event will get
            // the updated view-manager
            if (theThis.CurrentViewManagerChanged != null)
            {
                theThis.CurrentViewManagerChanged(theThis, EventArgs.Empty);
            }

            //refresh filter
            if (null != theThis.CategoryList)
            {
                theThis.CategoryList.RefreshFilter();
            }
        }