views:

438

answers:

1

I have the need to show RowDetails in the WPF DataGrid when the user performs an action outside of the grid. The thing is though, I need to be able to switch out exactly what the RowDetails will be based on that. For example, if the click Add, I want to show RowDetails below Row of type AddRowDetailControl, and if they choose Edit, I would want to show a different control under the same row instead. Is this possible?

A: 

You'll have to create the datatemplate of your RowDetails dynamically based on what your requirement is. Inside the datatemplate you can put the controls you need.

Have a look here: http://www.codeproject.com/KB/WPF/WPFDataGridExamples.aspx

Tony
You don't have to create the templates dynamically, you can prepare two templates in your resource dictionary, and dynamically (perhaps using a template selector) switch between them.
Aviad P.
@Aviad - That is an even better solution! :)
Tony
Thanks, I'm going to use the template selector along with the method to set the visibility of the row details. SetDetailsVisibilityForItem
thedesertfox