开发者

Custom controls on DataGrid Header (not ColumnHeader)

开发者 https://www.devze.com 2023-03-09 22:01 出处:网络
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,

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:

  1. Create a UserControl that includes a DataGrid plus your additional controls located above the DataGrid, perhaps using a Grid with two rows for layout.
  2. 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.

0

精彩评论

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

关注公众号