MahApps / MahApps.Metro

A framework that allows developers to cobble together a better UI for their own WPF applications with minimal effort.
https://mahapps.com
MIT License
9.29k stars 2.45k forks source link

GlowWindow in TaskManager #489

Closed wfuerst closed 11 years ago

wfuerst commented 11 years ago

Hello,

With using the new version including the GlowWindow, i noticed that the task manager displays multiple processes, see screenshot:

snipimage

Any ideas?

Thanks

punker76 commented 11 years ago

What version?

Please include the version of the library which you are using. This will help us to isolate the issue quicker.

wfuerst commented 11 years ago

Version is MahApps.Metro 0.11.0.23-ALPHA

punker76 commented 11 years ago

this could be a bug in this version, please take the latest and test it again. thanks.

wfuerst commented 11 years ago

Hello,

Its still the same problem. Just tested it with latest version.

AzureKitsune commented 11 years ago

A possible solution would be to have the Glow Windows set the 'AssociatedObject' as their Owner. I'll test it out later and throw together a PR (if anyone doesn't before me).

spiritdead commented 11 years ago

i have this bug too

finding in the browser, see this

http://stackoverflow.com/questions/7539235/stop-windows-from-showing-up-as-tasks-from-task-manager-wpf-c-sharp

spiritdead commented 11 years ago

check here

public class GlowWindowBehavior : Behavior { private GlowWindow left, right, top, bottom; 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) =>
        {
            if (left != null) left.Close();
            if (right != null) right.Close();
            if (top != null) top.Close();
            if (bottom != null) bottom.Close();
        };
    }

im sure here is the problem

this is the fix

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);
            left.Owner =(MetroWindow)sender;
            right.Owner = (MetroWindow)sender;
            top.Owner = (MetroWindow)sender;
            bottom.Owner = (MetroWindow)sender;
            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();
        };
    }
bitterskittles commented 11 years ago

Is there a reason why GlowWindowBehavior creates 4 GlowWindows instead of 1 GlowWindow with a glowing border & transparent middle?