NavigationSampleApp: name 'InitializeComponent' does not exist in the current context
NavigationSampleApp - Chapter 5 - page 159 - 166 of 2011 copyright
When build get error: The name 'InitializeComponent' does not exist in the current context...
This error is caused because the book seems to use a project name that is different from the book's listed code and different from the downloaded source code. If you do the example and name the project "NavigationSample" vs "NavigationSampleApp", you will avoid this error and others.
If you use a Project Name as the book says of: NavigationSampleApp
, the namespace and x:Class= should have the same name. These are generally at or near the top of the files where used:
namespace NavigationSampleApp
x:Class="NavigationSampleApp.xxpagenamexx"
errors in book:
page 159 - Customer.cs - s/b: namespace NavigationSampleApp
page 160 - CustomerDetails.xaml - s/b: x:Class="NavigationSampleApp.CustomerDetails"
page 161 - MainPage.xaml - s/b: x:Class="NavigationSampleApp.MainPage"
page 163 - MainPage.xaml.cs - private void LoadCustomers() -
NavigationSample.App s/b NavigationSampleApp.App
page 165 - CustomerDetails.xaml.cs - s/b namespace NavigationSampleApp
page 165 - CustomerDetails.xaml.cs -protected override void ....
NavigationSample.App s/b NavigationSampleApp.App
For a beginners book, my opinion is that it is better to have accurate book instructions that match the book example code and the book's download code.
|