コード例 #1
0
        }         // OnWindowSettingsChanged

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

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

            DependencyProperty dependencyProperty = e.NewValue as DependencyProperty;

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

            // search the window settings
            WindowSettings windowSettings =
                frameworkElement.ReadLocalValue(DependencyPropertySetting.ApplicationSettingsProperty) as WindowSettings;

            if (windowSettings == null)
            {
                Debug.WriteLine("WindowSettings: missing window settings in element " + frameworkElement);
                return;
            }

            DependencyPropertySettingCollector collector =
                new DependencyPropertySettingCollector(frameworkElement, dependencyProperty);

            windowSettings.SettingCollectors.Add(collector);
        }         // OnCollectedSettingChanged
コード例 #2
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