在我们公司,我们习惯使用WinForms开发应用程序,现在我们决定使用Caliburn.Micro和Modern UI切换到WPF-MVVM.我们想要达到的目标是拥有一个小应用程序: - 1个现代窗口 - 现代窗口内的2个页面的目标是在该页面内有一个按钮,用于将现代窗口导航到带参数的第二个页面.
我一直在努力了解如何解决这个问题,我成功地使用了Window(没有MUI),但是当谈到MUI时,它并没有真正给我我想要的结果.
到目前为止,我所做的一切都是
将App.xaml更改为
<Application x:Class="MuiWithCaliburn01.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:MuiWithCaliburn01">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<local:AppBootstrapper x:Key="bootstrapper" />
<local:ModernContentLoader x:Key="ModernContentLoader" />
</ResourceDictionary>
<ResourceDictionary Source="/FirstFloor.ModernUI;component/Assets/ModernUI.xaml" />
<ResourceDictionary Source="/FirstFloor.ModernUI;component/Assets/ModernUI.Light.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Run Code Online (Sandbox Code Playgroud)
创建Bootstrapper类
public class AppBootstrapper : BootstrapperBase
{
static AppBootstrapper()
{
}
public AppBootstrapper()
{
Initialize();
}
protected override void OnStartup(object sender, StartupEventArgs e)
{
DisplayRootViewFor();
}
}
Run Code Online (Sandbox Code Playgroud)创建ModernContentLoader类
public class ModernContentLoader : DefaultContentLoader
{
protected override object LoadContent(Uri uri)
{
var content = base.LoadContent(uri);
if …Run Code Online (Sandbox Code Playgroud)