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?
1 Answer
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
3 Comments
Aviad P.
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.
Tony The Lion
@Aviad - That is an even better solution! :)
dariusriggins
Thanks, I'm going to use the template selector along with the method to set the visibility of the row details. SetDetailsVisibilityForItem