Beispiel #1
0
        } // OnFrameworkElementSettingsChanged

        // ----------------------------------------------------------------------
        private static void OnCollectedSettingChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
        {
            FrameworkElement frameworkElement = dependencyObject as FrameworkElement;

            if (frameworkElement == null)
            {
                Debug.WriteLine("FrameworkElementSettings: invalid framework element");
                return;
            }

            DependencyProperty dependencyProperty = e.NewValue as DependencyProperty;

            if (dependencyProperty == null)
            {
                Debug.WriteLine("FrameworkElementSettings: missing dependency property");
                return;
            }

            // search the framework element settings
            FrameworkElementSettings frameworkElementSettings =
                frameworkElement.ReadLocalValue(DependencyPropertySetting.ApplicationSettingsProperty) as FrameworkElementSettings;

            if (frameworkElementSettings == null)
            {
                Debug.WriteLine("FrameworkElementSettings: missing framework element settings in element " + frameworkElement);
                return;
            }

            DependencyPropertySettingCollector collector =
                new DependencyPropertySettingCollector(frameworkElement, dependencyProperty);

            frameworkElementSettings.SettingCollectors.Add(collector);
        } // OnCollectedSettingChanged
        } // OnFrameworkElementSettingsChanged

        // ----------------------------------------------------------------------
        private static void OnCollectedSettingChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
        {
            FrameworkElement frameworkElement = dependencyObject as FrameworkElement;
            if (frameworkElement == null)
            {
                Debug.WriteLine("FrameworkElementSettings: invalid framework element");
                return;
            }

            DependencyProperty dependencyProperty = e.NewValue as DependencyProperty;
            if (dependencyProperty == null)
            {
                Debug.WriteLine("FrameworkElementSettings: missing dependency property");
                return;
            }

            // search the framework element settings
            FrameworkElementSettings frameworkElementSettings =
                    frameworkElement.ReadLocalValue(DependencyPropertySetting.ApplicationSettingsProperty) as FrameworkElementSettings;
            if (frameworkElementSettings == null)
            {
                Debug.WriteLine("FrameworkElementSettings: missing framework element settings in element " + frameworkElement);
                return;
            }

            DependencyPropertySettingCollector collector =
                new DependencyPropertySettingCollector(frameworkElement, dependencyProperty);
            frameworkElementSettings.SettingCollectors.Add(collector);
        } // OnCollectedSettingChanged