我建立了一个新项目来测试附加的依赖项属性,它导致了这样的错误:
错误XLS0415在类型“测试”中找不到可连接属性“名称”。 WpfCustomControlLibrary1 UserControl1.xaml
我的项目有什么问题?我的项目只有两个文件。
Test.cs:
public static class Test
{
public static readonly DependencyProperty NameProperty = DependencyProperty.RegisterAttached("Name", typeof(int), typeof(Test));
}
UserControl1.xaml:
<UserControl x:Class="WpfCustomControlLibrary1.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:WpfCustomControlLibrary1"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800" local:Test.Name="1">
<Grid>
</Grid>
</UserControl>