How do I sublass a control along with its attached properties?
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>
精彩评论