开发者

How do I sublass a control along with its attached properties?

开发者 https://www.devze.com 2023-02-13 05:40 出处:网络
I am trying to subclass System.Windows.Contro开发者_开发百科ls.DataGrid in order to add special commands to which a view model can bind.How do I do this and still have the Columns attached property? D

I am trying to subclass System.Windows.Contro开发者_开发百科ls.DataGrid in order to add special commands to which a view model can bind. How do I do this and still have the Columns attached property? Do I have to declare it against my new type in order to use it?


Columns is not an attached property.. you should use it the same way you always do, just replace DataGrid with your-control-name:

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

精彩评论

暂无评论...
验证码 换一张
取 消