With the DataGrid there is the following problem - the DataGrid has IsReadOnly = "False", but I need to make some cells and rows not editable, but accessible for selection. For DataGridCell and DataGridRow, I couldn’t programmatically restrict editing via IsReadOnly. I’ve been able to restrict editing via IsEnabled, but then I cannot select a cell (row) even if I explicitly set row. IsHitTestVisible = true:
DataGridRow row = (DataGridRow)dataGrid.ItemContainerGenerator .ContainerFromIndex(1); row.IsEnabled = false; row.IsHitTestVisible = true; How can I programmatically prohibit editing, but not prohibit the selection of a cell or row?