This project is read-only.

Set Startup Position and Owner

Jan 8, 2013 at 1:43 PM

Is there a way to set the startup position and owner?

Jan 11, 2013 at 10:59 PM
Edited Jan 12, 2013 at 5:15 PM


so far this is not possible. I will look at that in the next days.

Best Regards,


Jan 18, 2013 at 10:18 PM


you can now set startup position and owner in the new version. Just use following code:

Gat.Controls.OpenDialogViewModel vm = (Gat.Controls.OpenDialogViewModel)openDialog.DataContext;

vm.Owner = MainWindow;
vm.StartupLocation = System.Windows.WindowStartupLocation.CenterScreen;

Best regards,



Jul 17, 2015 at 9:28 PM
The problem with this, however, is that it requires the view model to have a reference to System.Windows, and it shouldn't have that reference (only the views would have a reference to System.Windows).

Caliburn Micro lets you get access to your view with its GetView method. Note that GetView returns an Object and not a System.Windows.Window type so that the view model can pass the view instance along, but still doesn't need to have a reference to System.Windows. It would be nice if Open Dialog did the same for its Owner parameter (which would be better name View, in this regard).

For the StartupLocation the only thing I can think of is for Open Dialog to create it's own enum name OpenDialogStarrtupLocation and that would be the type of the StartupLocation parameter. Doing this abstracts the System.Windows.WindowStartupLocation away, so that view models again do not need to have a reference to System.Windows.

I think these adjustments would have to be made in order to claim Open Dialog uses the MVVM pattern.