“InitializeComponent() does not exist in the current context” after copying XAML files

Situation

You copied XAML files in Visual Studio.

Problem

Visual Studio now can’t compile anymore, reporting that the InitializeComponent() method in the code-behind of your XAML files does not exist in the current context.

Solution

The build action of your XAML files has probably changed to “Resource”. Change it (back) to “Page”.

Sources

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.