I'm new to WPF Prism, I have seen many online article about Prism and I found all of example code are using windows application as shell, so I have a question, can i let UserControl as a shell? if not why?
The shell is supposed to be a window since a WPF application always has a top-level window (unless hosted in a broswer as an XBAP) but you could set the Content
of the window to a user control in the InitializeShell()
method of your bootstrapper:
protected override DependencyObject CreateShell()
{
return Container.Resolve<MainWindow>();
}
protected override void InitializeShell()
{
Application.Current.MainWindow.Content = new UserControl();
Application.Current.MainWindow.Show();
}
A UserControl
must be hosted in a window or page. It is not a top-level control.