Beispiel #1
0
        private static void AeroGlassChromePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (DesignerProperties.GetIsInDesignMode(d))
            {
                return;
            }

            if (!(d is Window window))
            {
                throw new ArgumentException("d must be Window");
            }
            var ch = e.NewValue as AeroGlassChrome;

            if (ch == null)
            {
                throw new ArgumentException("AeroGlass type expected ");
            }

            ch.OwnerWindow = window;

            //associate initializer to window
            var initializer = ChromeInitializer.GetChromeInitializer(window);

            if (initializer == null)
            {
                initializer = new ChromeInitializer()
                {
                    ChromeBase = ch
                };                                                       //initialize source
                ChromeInitializer.SetChromeInitializer(window, initializer);
            }
            else
            {
                initializer.ChromeBase = ch;
            }


            if (!window.IsLoaded)
            {
                window.Loaded += WindowLoadedHandler;
            }
            else
            {
                if (!ch.IsInitialized)
                {
                    WindowLoadedHandler.Invoke(window, null);
                }
            }
        }
Beispiel #2
0
        private static void AcrylicChromePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (DesignerProperties.GetIsInDesignMode(d))
            {
                return;
            }

            if (!(d is Window window))
            {
                throw new ArgumentException("d must be Window");
            }
            var ch = e.NewValue as AcrylicChrome;

            if (ch == null)
            {
                throw new ArgumentException("AeroGlass type expected ");
            }

            ch.OwnerWindow = window;

            //associate initializer to window
            if (ch.SuppressLagging)
            {
                SetAcrylicInitializer(ch, window);
            }
            else
            {
                SetChromeInitializer(ch, window);
            }

            if (!window.IsLoaded)
            {
                window.Loaded += WindowLoadedHandler;
            }
            else
            {
                if (!ch.IsInitialized)
                {
                    WindowLoadedHandler.Invoke(window, null);
                }
            }
        }