我希望我知道我做了什么导致这种情况,但我根本无法将 Visual Studio 2008 Designer 与 MVVMLight 模板一起使用。我在我的任何 xaml 页面中都收到“无法创建类型为 'ViewModelLocator' 的实例。应用程序构建和运行正常,但只有设计器损坏。在 App.xaml 中
<Application x:Class="ExcelReportGenerator.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:ExcelReportGenerator.ViewModel"
xmlns:res="clr-namespace:ExcelReportGenerator.Resources"
Startup="Application_Startup"
mc:Ignorable="d">
<Application.Resources>
<!--Global View Model Locator-->
<vm:ViewModelLocator x:Key="Locator"
d:IsDataSource="True" />
</Application.Resources>
我什至在创建全新的 MVVMLight 应用程序时收到错误消息。有趣的是,如果我使用 VS2010 的快速版本,我可以很好地查看、编辑和在设计器中工作。尽管我很想去 VS2010,但我现在无法说服 IT 采取行动。
其他系统信息:Windows 7 (x64) prof,我还有 dpack 和 coderush express 插件。