无法在 WPF 中创建继承的用户控件,本地命名空间中的基本控件 "does not exist"

Cannot create inherited usercontrol in WPF, base control "does not exist" in local namespace

我尝试在 WPF 中创建自定义用户控件 "UserControl1",它继承自基础 class。除其他外,我在 XAML 中收到此错误: 错误 XDG0008 命名空间 "clr-namespace:Temp" 中不存在名称 "ControlBase"。 我在 DesignHeight & Width

也遇到了错误

ControlBase class 在 VS 自动补全中可用。

ControlBase class 在名称空间 Temp 中定义。

我已经尝试更改基础关键字 class,例如添加部分关键字。

UserControl1.xaml:

<local:ControlBase x:Class="Temp.UserControl1"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:Temp"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="800">
    <Grid>

    </Grid>
</local:ControlBase>

UserControl1.xaml.cs:

namespace Temp
{
    /// <summary>
    /// Interaction logic for UserControl1.xaml
    /// </summary>
    public partial class UserControl1 : ControlBase
    {
        public UserControl1()
        {
            InitializeComponent();
        }
    }
}

ControlBase.cs:

using System.Windows.Controls;

namespace Temp
{
    public class ControlBase : UserControl
    {
        public ControlBase() { }
    }
}

我希望 UserControl1 继承自 ControlBase 而不会出现编译器错误。

我不知道我做了什么,但它自己修复了。