无法在“MiniListView”类型的“Headers”属性上设置“绑定”。 ‘绑定’只能在DependencyObject的DependencyProperty上设置

我的代码,

  

守则背后:

  public Dictionary MyHeaders { get { Dictionary dic = new Dictionary(); dic.Add("NAME", "BRANCH"); dic.Add("BANKNAME", "Percentage"); return dic; } } 

我的自定义类:ministView

 public class MiniListView : ListView { public static DependencyProperty HeadersProperty; public Dictionary Headers { get { return (Dictionary)base.GetValue(HeadersProperty); } set { base.SetValue(HeadersProperty, value); } } public MiniListView() { HeadersProperty = DependencyProperty.Register("Headers", typeof(Dictionary), typeof(MyListView)); this.View = MyGrid(); } } 

在这里,我正在尝试使用MyHeaders绑定HEADER’S PROPERTY,收到此错误

无法在“MiniListView”类型的“Headers”属性上设置“绑定”。 ‘绑定’只能在DependencyObject的DependencyProperty上设置。

请告诉我我的代码有什么问题。

谢谢,

依赖项属性注册中的Owner type不正确。 它应该是MiniListView而不是MyListView

 HeadersProperty = DependencyProperty.Register("Headers", typeof(Dictionary), typeof(MiniListView));