这个问题在这里已经有了答案:
9年前关闭。
Possible Duplicate:
WPF: how to display enum property values in vs2008 xaml editor intellisense?
在 XAML 中,如果我为 StackPanel 定义 Orientation 属性,IntelliSense 会显示 Orientation 枚举。如果我使用基于枚举的 DependencyProperty 定义自己的控件,有没有办法让 IntelliSense 调出枚举?
枚举:
public enum MyEnum { Foo, Bar }
DependencyProperty 控制:
public static readonly DependencyProperty MyEnumValueProperty =
DependencyProperty.Register(
"MyEnumValue",
typeof(MyEnum),
typeof(MyControl),
new UIPropertyMetadata());
public MyEnum MyEnumValue
{
get { return (MyEnum)GetValue(MyEnumValueProperty); }
set { SetValue(MyEnumValueProperty, value); }
}
编辑:
回答“丹尼尔普拉特”,因为他为我指明了正确的方向。我更喜欢代码示例。
要使其工作:
[程序集:XmlnsDefinition("http://schemas.your-company.com/wpf/ ", "YourNamespace")]
xmlns:control="http://schemas.your-company.com/wpf/"
最佳答案
关于wpf - 如何让 IntelliSense 在 XAML 中的自定义/用户控件上自动完成枚举?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/596089/