Recently I had an issue when trying to compile a silverlight project getting the following error.
InitializeComponent is not declared. It may be inaccessible due to its protection level
within my app.xaml.vb file.
Turns out the issue was that somehow I had changed the Build Action on the properties of the app.xmal file within Visual Studio 2010 environment. It is supposed to be ApplicationDefinition but I had it set as Resource.
Once returned to ApplicationDefinition my error went away.