【问题标题】:How do I sublass a control along with its attached properties?如何子类化控件及其附加属性?
【发布时间】:2011-07-04 09:53:56
【问题描述】:

我正在尝试继承 System.Windows.Controls.DataGrid 以添加视图模型可以绑定的特殊命令。我该如何做到这一点并且仍然拥有Columns 附加属性?我是否必须针对我的新类型声明它才能使用它?

【问题讨论】:

    标签: silverlight mvvm datagrid command subclassing


    【解决方案1】:

    Columns 不是附加属性。您应该像往常一样使用它,只需将 DataGrid 替换为 your-control-name:

    <my:MyDataGrid>
      <my:MyDataGrid.Columns>
         <!--  Columns goes here --->
      </my:MyDataGrid.Columns>
    </my:MyDataGrid>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-01-16
      • 1970-01-01
      • 2011-08-10
      • 1970-01-01
      • 2011-05-14
      • 1970-01-01
      • 2010-12-09
      • 1970-01-01
      相关资源
      最近更新 更多