0

I want to extend DataGrid to add some 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?

0

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

4 Comments

Option 1 is not suitable, because I want to extend DataGrid. The second option is very interesting, but how to do that? I suppose there are many xaml to dublicate default DataGrid functionality...
Why do you need to extend DataGrid? Your UserControl can expose the DataGrid it contains, giving you the same result. Anyhow, yes, DataGrid, like all Silverlight controls has a ControlTemplate which you can modify.
If I use first option and create UserControl, how to define columns in any page xaml for grid, which nested in UserControl (without resetting grid)?
Ok, I will use UserControl as wrapper for default DataGrid .You I right.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.