我有一个从类BIFUserControl
继承的UserControl
类。现在我正在设计一个新的用户控件BIFText
,它继承自BIFUserControl
类。因此,我更改了名为BIFText.xaml
如下的 XAML 文件:
<base:BIFUserControl
xmlns:base="clr-namespace:BaseInputFramework.BaseWidgets;assembly=BaseInputFramework"
x:Class="BIFWidgetLibrary.Text.BIFText"
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:mp="clr-namespace:Microsoft.Multipoint.Sdk.Controls;assembly=Microsoft.Multipoint.Sdk.Controls"
xmlns:utils="clr-namespace:BaseInputFramework.BaseWidgets.Utils;assembly=BaseInputFramework"
mc:Ignorable="d"
d:DesignHeight="150" d:DesignWidth="150">
<Grid>
</Grid> </base:BIFUserControl>
然后我改变了我的BIFText.xaml.cs
文件如下:
namespace BIFWidgetLibrary.Text {
public partial class BIFText : BIFUserControl
{
public BIFText()
{
InitializeComponent();
}
} }
但是现在当我尝试构建项目时,我收到以下错误消息:
'BaseInputFramework.BaseWidgets.BIFUserControl' cannot be the root of a XAML file because it was defined using XAML. Line 2 Position 14.
有人可以帮我解决这个错误。提前致谢。