The name ‘InitialzeComponent’ does not exist in the current context

在Visual Studio中创建Windows Store项目,在MainPage.xaml.cs中出现错误:

  • The name ‘InitialzeComponent’ does not exist in the current context

这个问题的出现通常会有两个方面的原因:

  1. 最常见的是MainPage.xaml中的x:Class与类名不一致。确认x:Class是正确的类和命名空间。
  2. 另一种情况就是,MainPage.xaml的Build Action没有设置为‘Page’。

删掉obj文件夹重新编译也可能解决问题。

=============================================

我的解决方案:

将MainPage.xaml的Build Action设置为‘ApplicationDefinition’,然后改回‘Page’。

 

参考资料:http://stackoverflow.com/questions/17853898/the-name-initializecomponent-does-not-exist-in-the-current-context-cannot-get

posted @ 2015-07-23 12:04  维博.WILBUR  阅读(458)  评论(0编辑  收藏  举报