【发布时间】:2011-12-01 11:16:00
【问题描述】:
我正在尝试通过以下方式将文本块属性的默认值用于控件:
public static readonly DependencyProperty FontFamilyProperty = DependencyProperty.Register(
"FontFamily", typeof(FontFamily), typeof(IMTextBlock), new PropertyMetadata(TextBlock.TextProperty.GetMetadata(typeof(FontFamily)).DefaultValue));
我收到此错误:
The invocation of the constructor on type 'Common.Infrastructure.Controls.IMTextBlock' that matches the specified binding constraints threw an exception.
这样做的正确方法是什么?
TextBlock.TextProperty.GetMetadata(typeof(FontFamily)).DefaultValue
没有给我正确的默认值,或者我没有正确使用它。任何帮助是极大的赞赏。提前致谢。
【问题讨论】:
标签: silverlight silverlight-4.0 dependency-properties default-value