How is a DataTemplate
applied to a Grid
?
I have a DataTemplate
named DataGrid_Template in my Resources.xaml
file that I would like to apply to a Grid
in View.xaml.
Resources.xaml
<ResourceDictionary ... >
<DataTemplate x:Key="DataGrid_Template">
<Grid>
<Grid.RowDefinitions ... />
<DockPanel ... />
<DataGrid ... />
</Grid>
</DataTemplate>
</ResourceDictionary>
View.xaml
<UserControl ... >
<Grid /> <!-- want to apply DataGrid_Template to this -->
</UserControl>
I tried using the Grid
property TemplatedParent
, but that seems to be a read-only property.