This project has moved. For the latest updates, please go here.

center align TaskDialog

Jan 19, 2011 at 2:25 PM


Showing the TaskDialog works just fine. However, I'm not able set the window alignment of the Dialog. Normally you can tell a window whether to center on the screen or in the parent window. I can't find a way to do this with TaskDialog.

Can someone help me with this?

Jan 19, 2011 at 2:59 PM


TaskDialog centers itself according to its owner. You should set the Owner property to the Window and it should work fine.



Jan 19, 2011 at 3:32 PM

Thanks for your answer.

The problem is that I don't really have a parent window. I want the TaskDialog to display some choices the user has when the application starts up. So I load it in the event handler of the Loaded event of my startup window. Assigning the Owner property to this window doesn't change the alignment of the TaskDialog. I assume that this is because the startup window isn't shown till after the TaskDialog has finished.

Jan 20, 2011 at 5:45 AM

I'm afraid I don't have an easy solution, then.

You can grab the source code and make modifications to the private TaskDialogWindow class, and perhaps expose the WindowStartupLocation as a property on TaskDialog.