こんにちは、テンプレートのスタックパネルにそれぞれ異なるデータコンテキストがあることを除けば、すべて同一の多数のデータグリッドテンプレート列を持つデータグリッドがあります。
<toolkit:DataGridTemplateColumn Header="Col 1">
<toolkit:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel DataContext="{Binding Times[0]}">
<!-- the structure that I want to extract to a template -->
</StackPanel>
</DataTemplate>
</toolkit:DataGridTemplateColumn.CellTemplate>
</toolkit:DataGridTemplateColumn>
<toolkit:DataGridTemplateColumn Header="Col 2">
<toolkit:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel DataContext="{Binding Times[1]}">
<!-- the same structure here -->
</StackPanel>
</DataTemplate>
</toolkit:DataGridTemplateColumn.CellTemplate>
</toolkit:DataGridTemplateColumn>
各列に特定の itemtemplate を使用させたいのですが (リストボックスで行ったように)、何かが欠けていない限り、その方法がわかりません。