Custom controls on DataGrid Header (not ColumnHeader)
I want to extend DataGrid to add 开发者_StackOverflowsome controls on the very top of the DataGrid control (not in the column headers). In other words, I want to render some controls (add/del button, filter TextBox) in the top half of CustomDataGrid (which inherits from DataGrid), and then render DataGrid in the bottom half.
In my pages I want to use this CustomDataGrid and set its columns and other options, which I usually set for default DataGrid.
How can I implement this?
You have a couple of options:
- Create a
UserControl
that includes aDataGrid
plus your additional controls located above theDataGrid
, perhaps using a Grid with two rows for layout. - Add your additional controls directly to the
DataGrid
template.
I would go for option (1), although you are not extending Datagrid
, it is much simpler to do.
精彩评论