コード例 #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);
                }
            }
        }
コード例 #2
0
        private static void SetChromeInitializer(AcrylicChrome ch, Window window)
        {
            var initializer = ChromeInitializer.GetChromeInitializer(window);

            if (initializer == null)
            {
                initializer = new ChromeInitializer()
                {
                    ChromeBase = ch
                };                                                         //initialize source
                ChromeInitializer.SetChromeInitializer(window, initializer);
            }
            else
            {
                initializer.ChromeBase = ch;
            }
        }
コード例 #3
0
        private static void TransparentChromePropertyChanged(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 TransparentChrome;

            if (ch == null)
            {
                throw new ArgumentException("Transparent 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;
            }
        }