Display WPF Popups in Lower Right Corner of Screen using PowerShell

I’ve recently changed my mind on this, but will leave the previous post up in case you want to reposition a WPF popup. If you want a big window to popup in the lower-right corner of the screen, use a WPF Window. WPF Popups are chromeless, it’s true, but they are also limiting in how you can move them around, and how they open and close. ToolTips and BalloonTips are useful, too, but have a character limit and are limiting in other ways.

Here is a super basic lower-right hand corner Window that works no matter how many monitors you have, unlike the popup solution below.

And here is what it looks like:


If you want to use the WPF Popup object

If you don’t want to use a WPF Window and you find yourself limited by notifyicon’s BalloonTips functionality, you can use WPF Popups to display information instead.


This picture is probably inaccurate ;)

Considering the nature of popups, placing them in the lower right should be easy, right? Well, Microsoft’s guide for popup placement was confusing to me, and StackExchange’s top-rated responses weren’t much more straight forward.

So after about twenty minutes of trial and error, I figured out that in order to create a popup in the lower right hand side of the screen, three things are required. First, the Popup’s Placement property must be set to AbsolutePoint. Then, the screen’s working area has to be determined and its values used to update the popup’s VerticalOffset and HorizontalOffset. This is similar to winform’s location property.

The following code will create a popup in the lower right hand corner if you have a single monitor. I don’t have a consistent solution for multiple monitors and Popups. Note that it will not create a notifyicon. That will be covered in my next post.

And here is what it looks like:


This code will work for any sized popup. Also, this form’s Window and Popup objects were stripped down to only the required properties. If you remove any of them, it won’t work as demonstrated.

I’m not a GUI pro, but my understanding of this is that an invisible form hosts a popup. You can’t see the form, and only the popup is visible. While StaysOpen=”False” usually allows the popup to close on LostFocus, it doesn’t work that way in this form. If StaysOpen is left out, the popup will never respond to the $form’s MouseDoubleClick event. You’ll just hear a ding when clicking the popup to close it. I’m assuming that’s Windows’ way of saying the action is forbidden.

Chrissy is a PowerShell MVP who has worked in IT for nearly 20 years, and currently serves as a Sr. Database Engineer in Belgium. Always an avid scripter, she attended the Monad session at Microsoft’s Professional Developers Conference in Los Angeles back in 2005 and has worked and played with PowerShell ever since. Chrissy is currently pursuing an MS in Systems Engineering at Regis University and helps maintain RealCajunRecipes.com in her spare time. She holds a number of certifications, including those relating to SQL Server, SuSE Linux, SharePoint and network security. She recently became co-lead of the SQL PASS PowerShell Virtual Chapter. You can follow her on Twitter at @cl.

Posted in PowerShell, WPF
One comment on “Display WPF Popups in Lower Right Corner of Screen using PowerShell
  1. Gael says:

    Nice post!
    I had to do something similar a while back with PowerShell and I used WPF-notifyIcon.
    It’s a c# lib on codeproject, very convenient with plenty of examples, but you probably know already!

Leave a Reply

Your email address will not be published. Required fields are marked *


Migrating SQL Server?

dbatools is an awesome PowerShell module that helps you migrate entire instances with a single command.

Available from dbatools.io and github

SqlServer Needs You

SqlServer now has a dedicated engineer and Microsoft is asking for our input!

Upvote priorities and cmdlets now


Chrissy LeMaire

Brandon Abshire
View Brandon Abshire, MCDBA's profile on LinkedIn


Chrissy has been awarded the Microsoft MVP for her work in the PowerShell community.

Join us!

Belgian PowerShell
User Group

  SQL PASS PowerShell
Virtual User Group


Upvotes Needed

Help persuade Microsoft to open source SQL Server's PowerShell module, SQLPS.

Upvote now on Microsoft Connect