如何使用XAML从同一模块中的自定义控件继承?
我试图从我在项目中编写的控件继承(使用XAML)。我试过使用空白页,但我甚至无法使用:如何使用XAML从同一模块中的自定义控件继承?,xaml,windows-8,windows-runtime,windows-store-apps,c++-cx,Xaml,Windows 8,Windows Runtime,Windows Store Apps,C++ Cx,我试图从我在项目中编写的控件继承(使用XAML)。我试过使用空白页,但我甚至无法使用: <local:BlankPage x:Class="MyNamespace.MyPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:M
<local:BlankPage
x:Class="MyNamespace.MyPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MyNamespace"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid>
</Grid>
</local:BlankPage>
BlankPage
只是通过向导创建的新的空白页派生类I<代码>我的页面是相同的。我得到的错误是:
找不到类型“local:BlankPage”。请确认您不是
缺少程序集引用,并且所有引用的程序集都具有
已经建成
如何在XAML中为WinRT/Windows应用商店应用程序执行继承?查看您的XAML:
<local:BlankPage
您是否构建了该项目?如果项目是生成的,名称空间是否与生成的元数据文件的名称匹配(或者,元数据文件的名称至少是名称空间名称的前缀)?(默认情况下,元数据文件与项目具有相同的名称。)您好,是的,项目已生成,并且它们都使用相同的命名空间。我可以通过在MyPage.xaml.h中包含BlankPage.xaml.h来实现它。但这似乎是一个黑客!切勿使用h
文件拧紧螺钉。这不仅仅是一种黑客行为,它不起作用。我正在尝试实现XAML继承,即MyPage
继承自BlankPage
。
<local:MyPage