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
2010-01-05 17:51:58
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.
2010-01-05 18:10:19
@Aviad - That is an even better solution! :)
Tony
2010-01-05 18:19:23
Thanks, I'm going to use the template selector along with the method to set the visibility of the row details. SetDetailsVisibilityForItem
thedesertfox
2010-01-06 22:14:26