WPF和Caliburn C#在编译后没有渲染窗口
本文关键字:窗口 编译 Caliburn WPF | 更新日期: 2023-09-27 17:59:37
我想尝试用Caliburn.Micro框架创建一个WPF应用程序,但我遇到了一个问题。我在Silverlight中看到了很多教程的来源,但在WPF上并不好。我有Silverlight教程中的所有内容,所有内容都经过编译,但没有渲染。
<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:CaliburnTest"
x:Class="CaliburnTest.App">
<Application.Resources>
<local:AppBootstrapper x:Key="Bootstrapper" />
</Application.Resources>
</Application>
引导程序
namespace CaliburnTest
{
class AppBootstrapper : Bootstrapper<AppViewModel> {}
}
AppView
<Window x:Class="CaliburnTest.Views.AppView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="AppView" Height="350" Width="525">
<Grid>
</Grid>
</Window>
namespace CaliburnTest.Views
{
public partial class AppView
{
public AppView()
{
InitializeComponent();
}
}
}
AppModelView
using Caliburn.Micro;
namespace CaliburnTest.ViewModels
{
class AppViewModel : PropertyChangedBase
{
}
}
谢谢回复。
我发现了问题。它写得不好app.xaml应用程序资源这是xaml文件的正确内容
<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:CaliburnTest"
x:Class="CaliburnTest.App">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<local:AppBootstrapper x:Key="Bootstrapper" />
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>