Hi,
probably you have to specify an CellEditingTemplate for the DataGridTemplateColumn.
Try this:
<datagridtemplatecolumn.celleditingtemplate>
<datatemplate>
<my:autocompletebox height="23" horizontalalignment="Left" margin="0,0,0,0" itemssource="{Binding AllRoles, RelativeSource={RelativeSource FindAncestor, AncestorType=UserControl}}" name="autoCompleteBox1" verticalalignment="Top" width="180" xmlns:my="#unknown" />
</datatemplate>
</datagridtemplatecolumn.celleditingtemplate>
That sets the editing template to the same as your "display" template of the column.
After examining your bindings, you should add a binding to your MaterialCode property in the autocompletebox template:
Text={Binding Path=MaterialCode}
Hope this helps.