I wish to have a custom column type in a WPF datagrid, part of which will be a textbox for user input. Unfortunately, it does not appear to inherit the look and feel of the datagrid itself- it doesn't show the alternating colour, when a row is selected or edited the cell in question doesn't highlight in the same way, and so on.
<DataGridTemplateColumn Header="Name" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate >
<TextBox Text="{Binding DisplayName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" IsReadOnly="False" BorderThickness="0" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
It looks like the style of a default textbox overrides that of the datagrid; is there a way just to use the datagrids style? I could of course style the textbox to mimic the datagrid, but if I wish to add other controls I'd have to do that for each one as well. If I do go down that route, how would I change the style based on properties of the datagridrow from within the celltemplate?- for example IsSelected.