【发布时间】:2009-12-22 11:44:22
【问题描述】:
Silverlight 4,VS 2010。
制作自定义控件。 (不仅仅是 UserControl,还有公共类 HandPart : Control 和 \themes 中的模板)
然后我使用助手 sn-p 创建一个新的 DependencyProperty:
#region SomeDouble (DependencyProperty)
/// <summary>
/// A description of the property.
/// </summary>
public Double SomeDouble
{
get { return (Double)GetValue(SomeDoubleProperty); }
set { SetValue(SomeDoubleProperty, value); }
}
public static readonly DependencyProperty SomeDoubleProperty =
DependencyProperty.Register("SomeDouble", typeof(Double), typeof(HandPart),
new PropertyMetadata(0));
#endregion
因此,解决方案在编译时没有任何错误和消息,但无法启动。 当我使用例如 Int 类型 insted Double 或 Single 创建 DependencyProperty 时,它工作正常。
浮动有什么问题(功能?)?为什么我不能使用浮点类型创建 DP?
【问题讨论】:
标签: .net silverlight silverlight-4.0 dependency-properties