protected override void OnAttached() { base.OnAttached(); this.AssociatedObject.Loaded += (sender, e) => { left = new GlowWindow(this.AssociatedObject, GlowDirection.Left); right = new GlowWindow(this.AssociatedObject, GlowDirection.Right); top = new GlowWindow(this.AssociatedObject, GlowDirection.Top); bottom = new GlowWindow(this.AssociatedObject, GlowDirection.Bottom); Show(); left.Update(); right.Update(); top.Update(); bottom.Update(); }; this.AssociatedObject.Closed += (sender, args) => { left.Close(); right.Close(); top.Close(); bottom.Close(); }; }
protected override void OnAttached() { base.OnAttached(); var metroWindow = this.AssociatedObject as MetroWindow; if (metroWindow != null && metroWindow.UseNoneWindowStyle) { return; } this.AssociatedObject.Loaded += (sender, e) => { left = new GlowWindow(this.AssociatedObject, GlowDirection.Left); right = new GlowWindow(this.AssociatedObject, GlowDirection.Right); top = new GlowWindow(this.AssociatedObject, GlowDirection.Top); bottom = new GlowWindow(this.AssociatedObject, GlowDirection.Bottom); Show(); left.Update(); right.Update(); top.Update(); bottom.Update(); }; this.AssociatedObject.Closed += (sender, args) => { if (left != null) { left.Close(); } if (right != null) { right.Close(); } if (top != null) { top.Close(); } if (bottom != null) { bottom.Close(); } }; }