Popup not centered

Apr 5, 2011 at 5:12 PM

Hi at all,

I'm using caliburn micro's window manager to open a popup, how can I center this popup to the parent view?

Apr 5, 2011 at 5:18 PM
Edited Apr 5, 2011 at 5:20 PM

ops I found the solution in the HelloWindowManager sample

just use a dynamic object like this:

dynamic settings = new ExpandoObject();
settings.Placement = PlacementMode.Center;
settings.PlacementTarget = GetView(null);

and add it to the ShowPopup method

windowManager.ShowPopup(new DialogViewModel(), "Popup", settings);

sorry for the useless post :)

Apr 5, 2011 at 5:26 PM

Glad you figured it out! You can actually use an IDictionary<string, object> but using the ExpandoObject is a nice syntactical trick for creating dictionaries like that I think.

Oct 12, 2013 at 12:52 PM
Is there a simple solution for Silverlight as well? PlacementMode.Center does not seem to be available? MSDN reference