Reputation: 1147
I'm watching at this link about how to show row details.
http://www.wpftutorial.net/DataGrid.html#rowDetails
I'd like to put an user control there. But I have no idea to do that. Supose that I have to show differents user control for each one
Upvotes: 0
Views: 687
Reputation: 184622
You can create various DataTemplates
which contain instances of the UserControls
you want in the Resources
of the DataGrid
, then you can create a DataTemplateSelector
which chooses the right one for you and set that as the RowDetailsTemplateSelector
.
Edit: Resource use example:
<DataGrid.Resources>
<DataTemplate x:Key="ImageTemplate">
<uc:ImageUserControl Source="{Binding Image}"/>
</DataTemplate>
<DataTemplate x:Key="GraphTemplate">
<uc:GraphUserControl GraphData="{Binding Data}"/>
</DataTemplate>
</DataGrid.Resources>
Also make sure to read the DataTemplateSelector
documentation.
Upvotes: 2