Esempio n. 1
0
        internal GlowWindow(MetroChromeBehavior behavior, GlowWindowProcessor processor)
        {
            this.owner     = behavior.Window;
            this.processor = processor;

            this.WindowStyle           = WindowStyle.None;
            this.AllowsTransparency    = true;
            this.ShowActivated         = false;
            this.Visibility            = Visibility.Collapsed;
            this.ResizeMode            = ResizeMode.NoResize;
            this.WindowStartupLocation = WindowStartupLocation.Manual;
            this.Left        = processor.GetLeft(this.owner.Left, this.owner.ActualWidth);
            this.Top         = processor.GetTop(this.owner.Top, this.owner.ActualHeight);
            this.Width       = processor.GetWidth(this.owner.Left, this.owner.ActualWidth);
            this.Height      = processor.GetHeight(this.owner.Top, this.owner.ActualHeight);
            this.Orientation = processor.Orientation;
            this.HorizontalContentAlignment = processor.HorizontalAlignment;
            this.VerticalContentAlignment   = processor.VerticalAlignment;

            this.ownerState = this.WindowState;

            var bindingActive = new Binding("ActiveBrush")
            {
                Source = behavior,
            };

            this.SetBinding(ActiveGlowBrushProperty, bindingActive);

            var bindingInactive = new Binding("InactiveBrush")
            {
                Source = behavior,
            };

            this.SetBinding(InactiveGlowBrushProperty, bindingInactive);

            var bindingChromeMode = new Binding("Mode")
            {
                Source = behavior,
            };

            this.SetBinding(ChromeModeProperty, bindingChromeMode);

            this.owner.ContentRendered += (sender, args) =>
            {
                this.Show();
                this.Update();
            };
            this.owner.StateChanged += (sender, args) =>
            {
                this.Update();
                this.ownerState = this.owner.WindowState;
            };
            this.owner.LocationChanged += (sender, args) => this.Update();
            this.owner.SizeChanged     += (sender, args) => this.Update();
            this.owner.Activated       += (sender, args) => this.Update();
            this.owner.Deactivated     += (sender, args) => this.Update();
            this.owner.Closed          += (sender, args) => this.Close();
        }
Esempio n. 2
0
		internal GlowWindow(MetroChromeBehavior behavior, GlowWindowProcessor processor)
		{
			this.owner = behavior.Window;
			this.processor = processor;

			this.WindowStyle = WindowStyle.None;
			this.AllowsTransparency = true;
			this.ShowActivated = false;
			this.Visibility = Visibility.Collapsed;
			this.ResizeMode = ResizeMode.NoResize;
			this.WindowStartupLocation = WindowStartupLocation.Manual;
			this.Left = processor.GetLeft(this.owner.Left, this.owner.ActualWidth);
			this.Top = processor.GetTop(this.owner.Top, this.owner.ActualHeight);
			this.Width = processor.GetWidth(this.owner.Left, this.owner.ActualWidth);
			this.Height = processor.GetHeight(this.owner.Top, this.owner.ActualHeight);
			this.Orientation = processor.Orientation;
			this.HorizontalContentAlignment = processor.HorizontalAlignment;
			this.VerticalContentAlignment = processor.VerticalAlignment;

			this.ownerState = this.WindowState;

			var bindingActive = new Binding("ActiveBrush") { Source = behavior, };
			this.SetBinding(ActiveGlowBrushProperty, bindingActive);

			var bindingInactive = new Binding("InactiveBrush") { Source = behavior, };
			this.SetBinding(InactiveGlowBrushProperty, bindingInactive);

			var bindingChromeMode = new Binding("Mode") { Source = behavior, };
			this.SetBinding(ChromeModeProperty, bindingChromeMode);

			this.owner.ContentRendered += (sender, args) =>
			{
				this.Show();
				this.Update();
			};
			this.owner.StateChanged += (sender, args) =>
			{
				this.Update();
				this.ownerState = this.owner.WindowState;
			};
			this.owner.LocationChanged += (sender, args) => this.Update();
			this.owner.SizeChanged += (sender, args) => this.Update();
			this.owner.Activated += (sender, args) => this.Update();
			this.owner.Deactivated += (sender, args) => this.Update();
			this.owner.Closed += (sender, args) => this.Close();
		}