Ошибка указывающая на то, что 'InitializeComponent' не существует. C# (WPF)

Почему InitializeComponent не существует в текущем контексте? Что-то в XAML не то?

XAML

<Window x:Class="exapm_leWPF.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:exapm_leWPF"
        mc:Ignorable="d"
        Title="MainWindow" Height="500" Width="900" ResizeMode="NoResize">
    <Window.Background>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="#FF232D3E"/>
            <GradientStop Color="#FF1D222C" Offset="0.486"/>
            <GradientStop Color="#FF1D222C" Offset="1"/>
        </LinearGradientBrush>
    </Window.Background>
    <Grid Loaded="Grid_Loaded">
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition Height="400"/>
        </Grid.RowDefinitions>
        <Button Content="Button" HorizontalAlignment="Left" Margin="10,16,0,0" VerticalAlignment="Top" Height="42" Width="139"/>
        <Ellipse x:Name="DitectedState" HorizontalAlignment="Left" Height="16" Margin="880,3,0,0" Stroke="Black" Fill="Red" VerticalAlignment="Top" Width="16"/>
    </Grid>


</Window>

C#

using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Data.SqlClient;
using System.Data;

namespace exapm_leWPF
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        string ConnectionString = "Data Source=WIN-3T4UAQMUTGD\\SQLEXPRESS;Initial Catalog=pubs;Persist Security Info=True;User ID=LOGIN;Password=PASSWORD;Encrypt=False;";
        SqlConnection sqlCnct;

        public MainWindow()
        {
            InitializeComponent();
        }

        private void Grid_Loaded(object sender, RoutedEventArgs e)
        {

        }
    }
}

Ответы (1 шт):

Автор решения: смотрю кушою

Возможно вам нужно изменить свойство "Действие при сборке" Свойство страницы

→ Ссылка