如何在页面 XAML 中为 UWP 添加自定义面板?

How to add custom panel in page XAML for UWP?

所以我制作了一个如下所示的自定义面板:

 public class CustomPanel : Panel
 { 
    protected override Size MeasureOverride(Size constraint)
    {
      ...
    }  
    protected override Size ArrangeOverride(Size arrangeSize)
    {
     ...
    }
}

在我的项目中,我有文件 CustomPanel.cs。 现在我希望能够将此自定义面板放置在我的 MainPage.xaml 中,如下所示:

<Page x:Class="CustomPanelProject.Views.MainPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:local="using:CustomPanelProject.Views"
      xmlns:control="using:CustomPanelProject.Controls"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      mc:Ignorable="d">

<StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
            Orientation="Vertical">
    <control:CustomPanel>

    </control:CustomPanel>
</StackPanel>

所以我认为这种方法行得通,但设计人员一直显示此错误消息:

The name "CustomPanel" does not exist in the namespace "using:CustomPanelProject.Controls".

我错过了什么?也许面板应该像用户控件一样有一个相关的 xaml 文件?

如评论中所述,我的命名空间名称有问题。所以我的命名空间拼错了。非常愚蠢的错误。