I want to have my own column type in datagrid WPF, part of which will be a text box for user input. Unfortunately, it does not seem to inherit the appearance of the datagrid itself - it does not display alternating color when the row is selected or the cell in question is edited, it does not stand out in the same way, etc.
<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 default text box style overrides the datagrid file style; is there any way to use datagrids style? I could, of course, create a text box to mimic a datagrid, but if I want to add other controls, I have to do this for each one as well. If I share along this route, how would I change the style based on the datagridrow properties from inside the celltemplate? - for example IsSelected.
source share