You need to define an actual DataGridTemplateColumn
element first:
<data:DataGrid.Columns>
<!-- Columns ... -->
<data:DataGridTemplateColumn>
<data:DataGridTemplateColumn.CellTemplate>
</data:DataGridTemplateColumn.CellTemplate>
</data:DataGridTemplateColumn>
</data:DataGrid.Columns>
Note that in XAML syntax, when you have an element and sub-element like this:
<a>
<a.b>
content
</a.b>
</a>
Then this means to set the property b
of a
to "content". If the elements are of this form:
<a>
<b.c>
</b.c>
</a>
That can be legal also, but it means to set the attached dependency property c
of the class b
on the object a
. That's why you're seeing the error message:
The attachable property 'CellTemplate' was not found in type 'DataGridTemplateColumn'
The XAML parser thinks you're trying to attach a property DataGridTemplateColumn.CellTemplate
("b.c") to the element DataGrid.Columns
("a").