在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

相关文章:

  • 2021-07-04
  • 2022-12-23
  • 2021-11-02
  • 2021-08-31
  • 2021-10-10
  • 2022-12-23
  • 2022-12-23
  • 2022-02-06
猜你喜欢
  • 2021-11-08
  • 2021-12-05
  • 2022-12-23
  • 2021-11-16
  • 2022-12-23
  • 2022-12-23
  • 2021-07-09
相关资源
相似解决方案