Setting the size of wpf / caliburn.micro when resolving content with the main window.

I cannot figure out how to control the size of my application, allowing me to change the content in the main window. This is a WPF application, and I use Caliburn Micro (ViewModel first), and all of my views are UserControls.

I need the main view of UserControl (basically a grid that contains other user controls with its own view models) to stretch and fill the entire area of ​​the main application window. So I set HorizontalAlignment and VerticalAlignment on the Stretch main screen. But this does not work as I want.

If I set Height and Width on the main view to some value, this allows me to control the size of the main application window, but the view will be fixed and not resize using the main window.

If I set Height and Width in the main Auto view, then the size of the application window will be adjusted by the size of the main view, and not vice versa.

What I want is that the contents of the application window (the window is automatically created by Caliburn.Micro for the main view) is stretched to fill the application window, the size of which I set somehow. how to do it.

Hope you can help, I'm stuck!

+5
source share
2 answers

, , , Caliburn.Micro v1, - , Caliburn.Micro v2.

Bootstrapper OnStartup Width, Height SizeToContent.Manual DisplayRootViewFor, :

protected override void OnStartup(object sender, StartupEventArgs e)
{
   var settings = new Dictionary<string, object>
   {
       { "SizeToContent", SizeToContent.Manual },
       { "Height" , 600  },
       { "Width"  , 1024 },
   };

   DisplayRootViewFor<IShell>(settings);
}
+9

All Articles