银光 4,VS 2010。
制作自定义控件。(不仅是 UserControl,还有公共类 HandPart : Control 和 \themes 中的模板)
然后我使用帮助代码片段创建一个新的 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?