Reputation: 6463
In a DataGrid, I'm using the RowDetails area to load a UserControl with its own ViewModel - works very well.
<DataGrid.RowDetailsTemplate>
<DataTemplate>
<vw:IndicesView DataContext="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}},
Path=DataContext.DrillDownIndexVM}" />
</DataTemplate>
</DataGrid.RowDetailsTemplate>
I now want to use alternative UserControls, depending on a property in the main ViewModel.
How can this be done? Is the answer?
Upvotes: 0
Views: 228
Reputation: 1517
Check out WPF datatemplate selector http://www.switchonthecode.com/tutorials/wpf-tutorial-how-to-use-a-datatemplateselector
Upvotes: 1