The DataGridTextColumn is behaving the same whether it is autogenerated or not. You are setting IsReadOnly = True
. This may be one of the reasons why it behaves like you described. You could try to delete IsReadOnly="True"
or set IsReadOnly="False"
.
Update:
<DataGrid Name="Employees" Height="200"
AutoGenerateColumns="False" IsReadOnly="True"
EnableColumnVirtualization="True"
EnableRowVirtualization="True"
ItemsSource="{Binding EmployeesDataTable}"
SelectionUnit="CellOrRowHeader"
VirtualizingPanel.VirtualizationMode="Recycling">
<DataGrid.Columns>
<DataGridTemplateColumn>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox IsReadOnly="True" Text="{Binding Name}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
If the answer is the right solution, please click Accept Answer and kindly upvote it. If you have extra questions about this answer, please click Comment.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.