我有以下用户控件
public partial class TestCtrl : UserControl
{
public enum Alignments
{
HORIZONTAL,
VERTICAL
}
public TestCtrl()
{
InitializeComponent();
}
public static DependencyProperty AlignmentProperty = DependencyProperty.Register(
"Alignment",
typeof(Alignments),
typeof(TestCtrl),
new PropertyMetadata(Alignments.HORIZONTAL));
public Alignments Alignment
{
get
{
return (Alignments)GetValue(AlignmentProperty);
}
set
{
SetValue(AlignmentProperty, value);
}
}
}
该属性有效,但在 xaml 中使用该属性时,自动完成不会检测该属性的可能值。