Điều này rất lạ.Tại sao Visual Studio không thể tìm thấy phương pháp WPF InitializeComponent của tôi?
Tôi có một file XAML trông như sau ...
<Window
x:Name="window"
x:Class="ix.Production.Title"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Title" Height="768" Width="1024"
Loaded="window_Loaded">
<Window.Resources>
etc...
Và mã bên cạnh tôi trông như sau ...
using System;
using System.Windows;
using System.Windows.Media.Animation;
using System.Threading;
namespace ix.Production
{
public partial class Title : Window
{
public Title()
{
InitializeComponent();
}
....
Mã này từ chối để biên dịch vì Visual Studio nhấn mạnh rằng InitializeComponent "không tồn tại trong ngữ cảnh hiện tại."
Làm cách nào để khắc phục sự cố này?
Lỗi đánh máy, ngớ ngẩn từ phía tôi (tôi có hai dự án tương tự). Không gian tên lớp thực sự đúng, nhưng tôi vẫn gặp lỗi tương tự. – willem