默认值types与该属性的types不匹配

我有这个class

public class Tooth { public string Id {get;set;} } 

并且这个custrom控制

 public partial class ToothUI : UserControl { public ToothUI() { InitializeComponent(); } public Tooth Tooth { get { return (Tooth)GetValue(ToothProperty); } set { SetValue(ToothProperty, value); NombrePieza.Text = value.Id.Replace("_",String.Empty); } } public static readonly DependencyProperty ToothProperty = DependencyProperty.Register("Tooth", typeof(Tooth), typeof(ToothUI), new PropertyMetadata(0)); } 

我的问题是添加牙齿依赖属性后 ,这个错误发生

默认值types与该属性的types不匹配

究竟这个错误是什么意思? 目前设置这个DP方式是什么?

DP Default value与您的types不匹配。

更改

 public static readonly DependencyProperty ToothProperty = DependencyProperty.Register("Tooth", typeof(Tooth), typeof(ToothUI), new PropertyMetadata(0)); 

 public static readonly DependencyProperty ToothProperty = DependencyProperty.Register("Tooth", typeof(Tooth), typeof(ToothUI), new PropertyMetadata(default(Tooth))); 

或者干脆省略设置DP的默认值:

 public static readonly DependencyProperty ToothProperty = DependencyProperty.Register("Tooth", typeof(Tooth), typeof(ToothUI)); 

我来到这里的问题的标题,但我的types是一个十进制默认值,我用这个0.0M解决https://msdn.microsoft.com/en-us/library/83fhsxwc.aspx