[wpf] The name 'InitializeComponent' does not exist in the current context

The best shot at an MCVE in this thread is, with VS2017 15.5.2, load up the XAML of LabelControlAdvancedSample, the last example in this tutorial page.

<Window x:Class="WpfTutorialSamples.Basic_controls.LabelControlAdvancedSample"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="LabelControlAdvancedSample" Height="180" Width="250">
<StackPanel Margin="10">
    <Label Target="{Binding ElementName=txtName}">
        <StackPanel Orientation="Horizontal">
            <Image Source="http://cdn1.iconfinder.com/data/icons/fatcow/16/bullet_green.png" />
            <AccessText Text="_Name:" />
        </StackPanel>
    </Label>
    <TextBox Name="txtName" />
    <Label Target="{Binding ElementName=txtMail}">
        <StackPanel Orientation="Horizontal">
            <Image Source="http://cdn1.iconfinder.com/data/icons/fatcow/16/bullet_blue.png" />
            <AccessText Text="_Mail:" />
        </StackPanel>
    </Label>
    <TextBox Name="txtMail" />
</StackPanel>

Having left the App.xaml & App.xaml.cs at default, attempting to compile the above produces the linker error.
Fortunately, when hovering over the InitializeComponent() statement in LabelControlAdvancedSample.xaml.cs there is a linked text hint:

Show potential fixes.

Clicking it invokes another linked text:

Generate method MainWindow.InitializeComponent.

Doing this produces the following "do nothing" method:

    private void InitializeComponent()
    {
        throw new NotImplementedException();
    }

The function must be defined for the project to build. Looks like something differs in the implementation of InitializeComponent in WPF to VB.Net.
Edit: The namespace.class in the first line of the xaml is not correct. According to MSDN and @Sean B's answer, it should be

<Window x:Class="LabelControlAdvancedSample.MainWindow"

Thus the project compiles without error and the dummy InitializeComponent method is not required, in fact it generates more errors. Goes to show VS can be helpful, even in the extremely rare case of user error. :P

Examples related to wpf

Error: the entity type requires a primary key Reportviewer tool missing in visual studio 2017 RC Pass command parameter to method in ViewModel in WPF? Calling async method on button click Setting DataContext in XAML in WPF How to resolve this System.IO.FileNotFoundException System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll? Binding an Image in WPF MVVM How to bind DataTable to Datagrid Setting cursor at the end of any text of a textbox

Examples related to visual-studio-2010

variable is not declared it may be inaccessible due to its protection level SSIS Excel Connection Manager failed to Connect to the Source This project references NuGet package(s) that are missing on this computer Gridview get Checkbox.Checked value error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in CppFile1.obj What is the difference between Visual Studio Express 2013 for Windows and Visual Studio Express 2013 for Windows Desktop? Attach (open) mdf file database with SQL Server Management Studio What is and how to fix System.TypeInitializationException error? Could not load file or assembly "Oracle.DataAccess" or one of its dependencies IIS error, Unable to start debugging on the webserver

Examples related to visual-studio

VS 2017 Git Local Commit DB.lock error on every commit How to remove an unpushed outgoing commit in Visual Studio? How to download Visual Studio Community Edition 2015 (not 2017) Cannot open include file: 'stdio.h' - Visual Studio Community 2017 - C++ Error How to fix the error "Windows SDK version 8.1" was not found? Visual Studio Code pylint: Unable to import 'protorpc' Open the terminal in visual studio? Is Visual Studio Community a 30 day trial? How can I run NUnit tests in Visual Studio 2017? Visual Studio 2017: Display method references

Examples related to initializecomponent

The name 'InitializeComponent' does not exist in the current context