1
我曾尝试在DependencyProperty中使用Enum,但始终需要Enum的第一个值。为什么Enum在DependencyProperty中返回Enum的第一个值?
例如 我的枚举:
public enum LayoutType
{
Horizontal,
Vertical
}
财产申报:
public static readonly DependencyProperty LayoutTypeProperty =
DependencyProperty.RegisterAttached("LayoutType", typeof(LayoutType), typeof(ctrlAllLayouts), new PropertyMetadata(null));
我可以在我的XAML,但问题访问属性是它总能给值“水平”,如果将其设置是要么“水平”或“垂直”。你还必须声明匹配静态 setter和getter方法为它解析
+1提供代码和良好的描述 –