【发布时间】:2023-03-18 17:25:01
【问题描述】:
我曾尝试在 DependencyProperty 中使用 Enum,但它总是采用 Enum 的第一个值。
例如 我的枚举:
public enum LayoutType
{
Horizontal,
Vertical
}
财产声明:
public static readonly DependencyProperty LayoutTypeProperty =
DependencyProperty.RegisterAttached("LayoutType", typeof(LayoutType), typeof(ctrlAllLayouts), new PropertyMetadata(null));
我可以在我的 xaml 中访问该属性,但问题是如果将其设置为“水平”或“垂直”,它总是给出值“水平”。
【问题讨论】:
-
+1 用于提供代码和良好的描述
标签: silverlight enums dependency-properties