【发布时间】:2009-12-07 05:19:08
【问题描述】:
我尝试在自定义控件中使用枚举类型作为依赖属性,但总是报错:
public enum PriceCategories
{
First = 1,
Second = 2,
Third = 3,
Fourth = 4,
Fifth = 5,
Sixth = 6
}
public static readonly DependencyProperty PriceCatProperty =
DependencyProperty.Register("PriceCat", typeof(PriceCategories), typeof(CustControl), new PropertyMetadata(PriceCategories.First));
};
public PriceCategories PriceCat // here I get an error "Expected class, delegate, enum, interface or struct"
{
get { return (PriceCategories)GetValue(PriceCatProperty); }
set { SetValue(PriceCatProperty, value); }
}
请看。哪里出错了?
【问题讨论】:
标签: c# wpf enums custom-controls dependency-properties